| Safe Haskell | Safe-Inferred |
|---|---|
| Language | GHC2021 |
Effectful.Labeled.Provider
Synopsis
- data Provider (e :: Effect) (input :: Type) (f :: Type -> Type) :: Effect where
- ProvideWith :: input -> Eff (e : es) a -> Provider e input f (Eff es) (f a)
- type Provider_ e input = Provider e input Identity
- runProvider :: forall label e input f es a. HasCallStack => (forall r. HasCallStack => input -> Eff (e : es) r -> Eff es (f r)) -> Eff (Labeled label (Provider e input f) : es) a -> Eff es a
- runProvider_ :: forall label e input es a. HasCallStack => (forall r. HasCallStack => input -> Eff (e : es) r -> Eff es r) -> Eff (Labeled label (Provider_ e input) : es) a -> Eff es a
- provide :: forall label e f es a. (HasCallStack, Labeled label (Provider e () f) :> es) => Eff (e : es) a -> Eff es (f a)
- provide_ :: forall label e es a. (HasCallStack, Labeled label (Provider_ e ()) :> es) => Eff (e : es) a -> Eff es a
- provideWith :: forall label e input f es a. (HasCallStack, Labeled label (Provider e input f) :> es) => input -> Eff (e : es) a -> Eff es (f a)
- provideWith_ :: forall label e input es a. (HasCallStack, Labeled label (Provider_ e input) :> es) => input -> Eff (e : es) a -> Eff es a
- newtype Labeled (label :: k) (e :: Effect) :: Effect where
Effect
data Provider (e :: Effect) (input :: Type) (f :: Type -> Type) :: Effect where Source #
Provide a way to run a handler of e with a given input.
Note: f can be used to alter the return type of the effect handler. If
that's unnecessary, use Provider_.
Constructors
| ProvideWith :: input -> Eff (e : es) a -> Provider e input f (Eff es) (f a) | Run the effect handler with a given input. Since: 2.7.0.0 |
Instances
| type DispatchOf (Provider e input f) Source # | |
Defined in Effectful.Provider | |
type Provider_ e input = Provider e input Identity Source #
A restricted variant of Provider with unchanged return type of the effect
handler.
Handlers
Arguments
| :: forall label e input f es a. HasCallStack | |
| => (forall r. HasCallStack => input -> Eff (e : es) r -> Eff es (f r)) | The effect handler. |
| -> Eff (Labeled label (Provider e input f) : es) a | |
| -> Eff es a |
Run the labeled Provider effect with a given effect handler.
Arguments
| :: forall label e input es a. HasCallStack | |
| => (forall r. HasCallStack => input -> Eff (e : es) r -> Eff es r) | The effect handler. |
| -> Eff (Labeled label (Provider_ e input) : es) a | |
| -> Eff es a |
Run the labeled Provider effect with a given effect handler that doesn't
change its return type.
Operations
provide :: forall label e f es a. (HasCallStack, Labeled label (Provider e () f) :> es) => Eff (e : es) a -> Eff es (f a) Source #
Run the effect handler.
provide_ :: forall label e es a. (HasCallStack, Labeled label (Provider_ e ()) :> es) => Eff (e : es) a -> Eff es a Source #
Run the effect handler with unchanged return type.
Arguments
| :: forall label e input f es a. (HasCallStack, Labeled label (Provider e input f) :> es) | |
| => input | The input to the effect handler. |
| -> Eff (e : es) a | |
| -> Eff es (f a) |
Run the effect handler with a given input.
Arguments
| :: forall label e input es a. (HasCallStack, Labeled label (Provider_ e input) :> es) | |
| => input | The input to the effect handler. |
| -> Eff (e : es) a | |
| -> Eff es a |
Run the effect handler that doesn't change its return type with a given input.
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 | |