Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Labeled effects.
Any effect can be assigned multiple labels so you have more than one available simultaneously.
Since: 2.3.0.0
Effect
newtype Labeled (label :: k) (e :: Effect) :: Effect where Source #
Assign a label to an effect.
The constructor is for sending labeled operations of a dynamically dispatched effect to the handler:
>>>
import Effectful.Dispatch.Dynamic
>>>
:{
data X :: Effect where X :: X m Int type instance DispatchOf X = Dynamic :}
>>>
:{
runPureEff . runLabeled @"x" (interpret_ $ \X -> pure 333) $ do send $ Labeled @"x" X :} 333
Instances
type DispatchOf (Labeled label e) Source # | |
Defined in Effectful.Labeled | |
data StaticRep (Labeled label e) Source # | |
Defined in Effectful.Labeled |
Handlers
:: forall label e es a b. HasCallStack | |
=> (Eff (e : es) a -> Eff es b) | The effect handler. |
-> Eff (Labeled label e : es) a | |
-> Eff es b |
Run a Labeled
effect with a given effect handler.