bluefin-0.2.6.0: The Bluefin effect system
Safe HaskellNone
LanguageHaskell2010

Bluefin.Reader

Synopsis

Documentation

Reader is Bluefin's version of the Control.Monad.Trans.Reader monad. local allows you to locally override the value in the Reader handle in a well-scoped way. The original value will be restored when you exit the local block regardless of whether the exit was normal or via an exception .

Handle

data Reader r (e :: Effects) #

Instances

Instances details
e :> es => OneWayCoercible (Reader r e :: Type) (Reader r es :: Type) 
Instance details

Defined in Bluefin.Internal

Handle (Reader r) 
Instance details

Defined in Bluefin.Internal

Methods

handleImpl :: HandleD (Reader r) #

mapHandle :: forall (e :: Effects) (es :: Effects). e :> es => Reader r e -> Reader r es #

CloneableHandle (Reader r) 
Instance details

Defined in Bluefin.Internal.CloneableHandle

Handlers

runReader #

Arguments

:: forall r (es :: Effects) a. r

Initial value for Reader.

-> (forall (e :: Effects). Reader r e -> Eff (e :& es) a) 
-> Eff es a 

Effectful operations

ask #

Arguments

:: forall (e :: Effects) (es :: Effects) r. e :> es 
=> Reader r e

͘

-> Eff es r 

Read the value. Note that ask has the property that these two operations are always equivalent:

do
  r1 <- ask re
  r2 <- ask re
  pure (r1, r2)
do
  r <- ask re
  pure (r, r)

asks #

Arguments

:: forall (e :: Effects) (es :: Effects) r a. e :> es 
=> Reader r e 
-> (r -> a)

Read the value modified by this function

-> Eff es a 

Read the value modified by a function

local #

Arguments

:: forall (e1 :: Effects) (es :: Effects) r a. e1 :> es 
=> Reader r e1 
-> (r -> r)

In the body, the reader value is modified by this function.

-> Eff es a

Body

-> Eff es a 

Locally override the value in the Reader. It will be restored when the local block ends.