bluefin-0.7.0.1: The Bluefin effect system
Safe HaskellSafe-Inferred
LanguageHaskell2010

Bluefin.HandleReader

Description

This is an old interface and will be deprecated in the future. You are encouraged to use Bluefin.Capability.AskCapability instead.

HandleReader is like Reader, generalized to work for arbitrary Handles. localHandle locally overrides the value of a capability in a well-scoped way. The original capability 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. If you want to do the same in Bluefin you may want to start with Bluefin.GadtEffect.interpose.

Synopsis

Handle

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

Instances

Instances details
e <: es => OneWayCoercible (HandleReader h e :: Type) (HandleReader h es :: Type) 
Instance details

Defined in Bluefin.Internal

Methods

oneWayCoercibleImpl :: OneWayCoercibleD (HandleReader h e) (HandleReader h es) #

Handle (HandleReader h) 
Instance details

Defined in Bluefin.Internal

CloneableHandle h => CloneableHandle (HandleReader h) 
Instance details

Defined in Bluefin.Internal.CloneableHandle

Methods

cloneableHandleImpl :: CloneableHandleD (HandleReader h)

Handlers

runHandleReader :: 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 :: forall (e :: Effects) (es :: Effects) h. (e <: es, Handle h) => HandleReader h e -> Eff es (h es) #

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

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