bluefin-0.10.1.0: The Bluefin effect system
Safe HaskellNone
LanguageHaskell2010

Bluefin.Capability.AskCapability

Description

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

AskCapability 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 AskCapability (h :: Effects -> Type) (e :: Effects) #

Instances

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

Defined in Bluefin.Internal

Handle (AskCapability h) 
Instance details

Defined in Bluefin.Internal

CloneableHandle h => CloneableHandle (AskCapability h)

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

Instance details

Defined in Bluefin.Internal.CloneableHandle

Handlers

runAskCapability #

Arguments

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

͘

Effectful operations

asksCapability #

Arguments

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

͘

localCapability #

Arguments

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

͘

Deprecated versions

askCapability #

Arguments

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

͘

Do not use askCapability. It is unsafe and will be removed in a future version. Use asksCapability instead.