bluefin-0.2.6.0: The Bluefin effect system
Safe HaskellNone
LanguageHaskell2010

Bluefin.HandleReader

Description

HandleReader is like Reader, generalized to work for arbitrary Handles. localHandle locally overrides the value of a handle in a well-scoped way. The original handle will be restored when you exit the localHandle block regardless of whether the exit was normal or via an exception.

HandleReader supports functionality similiar to effectful's interpose and polysemy's intercept, that is, locally augmenting an effect with new behaviors.

Synopsis

Handle

data HandleReader (h :: Effects -> Type) (e :: Effects) #

Instances

Instances details
Handle h => Handle (HandleReader h) 
Instance details

Defined in Bluefin.Internal

Methods

handleImpl :: HandleD (HandleReader h) #

mapHandle :: forall (e :: Effects) (es :: Effects). e :> es => HandleReader h e -> HandleReader h es #

CloneableHandle h => CloneableHandle (HandleReader h)

Cloning a HandleReader copies its contents to a new HandleReader. Changes to one will not effect the other.

Instance details

Defined in Bluefin.Internal.CloneableHandle

Handlers

runHandleReader #

Arguments

:: forall (e1 :: Effects) (es :: Effects) h r. (e1 :> es, Handle h) 
=> h e1 
-> (forall (e :: Effects). HandleReader h e -> Eff (e :& es) r) 
-> Eff es r

͘

Effectful operations

askHandle #

Arguments

:: forall (e :: Effects) (es :: Effects) h. (e :> es, Handle h) 
=> HandleReader h e 
-> Eff es (h es)

͘

localHandle #

Arguments

:: forall (e :: Effects) (es :: Effects) h r. (e :> es, Handle h) 
=> HandleReader h e 
-> (h es -> h es) 
-> Eff es r 
-> Eff es r

͘