| Safe Haskell | Safe-Inferred |
|---|---|
| Language | GHC2021 |
Effectful.Labeled.ReturnWith
Description
Convenience functions for the Labeled ReturnWith effect.
Since: 2.7.0.0
Synopsis
- data ReturnWith r :: Effect where
- ReturnWith :: r -> ReturnWith r m a
- runReturnWith :: forall label r es. HasCallStack => Eff (Labeled label (ReturnWith r) : es) r -> Eff es r
- returnWith :: forall label r es a. (HasCallStack, Labeled label (ReturnWith r) :> es) => r -> Eff es a
- newtype Labeled (label :: k) (e :: Effect) :: Effect where
Effect
data ReturnWith r :: Effect where Source #
Provide the ability to return early with a value of type r.
Constructors
| ReturnWith :: r -> ReturnWith r m a |
Instances
| type DispatchOf (ReturnWith r) Source # | |
Defined in Effectful.ReturnWith.Dynamic | |
Handlers
runReturnWith :: forall label r es. HasCallStack => Eff (Labeled label (ReturnWith r) : es) r -> Eff es r Source #
Run a computation that can return early with a value of type r (via
Effectful.ReturnWith.Static).
Operations
Arguments
| :: forall label r es a. (HasCallStack, Labeled label (ReturnWith r) :> es) | |
| => r | The value. |
| -> Eff es a |
Return early with the given value.
Re-exports
newtype Labeled (label :: k) (e :: Effect) :: Effect where Source #
Assign a label to an effect.
Note: labeled effects are best used together with the effectful-plugin package, as it significantly improves their usability.
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 | |