| Safe Haskell | Safe-Inferred |
|---|---|
| Language | GHC2021 |
Effectful.Labeled.Provider.List
Description
Convenience functions for the Labeled ProviderList effect.
Since: 2.7.0.0
Synopsis
- data ProviderList (providedEs :: [Effect]) (input :: Type) (f :: Type -> Type) :: Effect where
- ProvideListWith :: forall providedEs input f es a. input -> Eff (providedEs ++ es) a -> ProviderList providedEs input f (Eff es) (f a)
- type ProviderList_ providedEs input = ProviderList providedEs input Identity
- runProviderList :: forall label providedEs input f es a. (HasCallStack, KnownSubset providedEs (providedEs ++ es)) => (forall r. HasCallStack => input -> Eff (providedEs ++ es) r -> Eff es (f r)) -> Eff (Labeled label (ProviderList providedEs input f) : es) a -> Eff es a
- runProviderList_ :: forall label providedEs input es a. (HasCallStack, KnownSubset providedEs (providedEs ++ es)) => (forall r. HasCallStack => input -> Eff (providedEs ++ es) r -> Eff es r) -> Eff (Labeled label (ProviderList_ providedEs input) : es) a -> Eff es a
- provideList :: forall label providedEs f es a. (HasCallStack, Labeled label (ProviderList providedEs () f) :> es) => Eff (providedEs ++ es) a -> Eff es (f a)
- provideList_ :: forall label providedEs es a. (HasCallStack, Labeled label (ProviderList_ providedEs ()) :> es) => Eff (providedEs ++ es) a -> Eff es a
- provideListWith :: forall label providedEs input f es a. (HasCallStack, Labeled label (ProviderList providedEs input f) :> es) => input -> Eff (providedEs ++ es) a -> Eff es (f a)
- provideListWith_ :: forall label providedEs input es a. (HasCallStack, Labeled label (ProviderList_ providedEs input) :> es) => input -> Eff (providedEs ++ es) a -> Eff es a
- newtype Labeled (label :: k) (e :: Effect) :: Effect where
- type family (xs :: [Effect]) ++ (ys :: [Effect]) :: [Effect] where ...
- class Subset subEs es => KnownSubset (subEs :: [Effect]) (es :: [Effect])
Effect
data ProviderList (providedEs :: [Effect]) (input :: Type) (f :: Type -> Type) :: Effect where Source #
Provide a way to run a handler of multiple providedEs with a given
input.
Note: f can be used to alter the return type of the handler. If that's
unnecessary, use ProviderList_.
Constructors
| ProvideListWith :: forall providedEs input f es a. input -> Eff (providedEs ++ es) a -> ProviderList providedEs input f (Eff es) (f a) | Run the effect handlers with a given input. Since: 2.7.0.0 |
Instances
| type DispatchOf (ProviderList providedEs input f) Source # | |
Defined in Effectful.Provider.List | |
type ProviderList_ providedEs input = ProviderList providedEs input Identity Source #
A restricted variant of ProviderList with unchanged return type of the
handler.
Handlers
Arguments
| :: forall label providedEs input f es a. (HasCallStack, KnownSubset providedEs (providedEs ++ es)) | |
| => (forall r. HasCallStack => input -> Eff (providedEs ++ es) r -> Eff es (f r)) | The handler. |
| -> Eff (Labeled label (ProviderList providedEs input f) : es) a | |
| -> Eff es a |
Run the labeled ProviderList effect with a given handler.
Arguments
| :: forall label providedEs input es a. (HasCallStack, KnownSubset providedEs (providedEs ++ es)) | |
| => (forall r. HasCallStack => input -> Eff (providedEs ++ es) r -> Eff es r) | The handler. |
| -> Eff (Labeled label (ProviderList_ providedEs input) : es) a | |
| -> Eff es a |
Run the labeled ProviderList effect with a given handler that doesn't
change its return type.
Operations
provideList :: forall label providedEs f es a. (HasCallStack, Labeled label (ProviderList providedEs () f) :> es) => Eff (providedEs ++ es) a -> Eff es (f a) Source #
Run the handler.
provideList_ :: forall label providedEs es a. (HasCallStack, Labeled label (ProviderList_ providedEs ()) :> es) => Eff (providedEs ++ es) a -> Eff es a Source #
Run the handler with unchanged return type.
Arguments
| :: forall label providedEs input f es a. (HasCallStack, Labeled label (ProviderList providedEs input f) :> es) | |
| => input | The input to the handler. |
| -> Eff (providedEs ++ es) a | |
| -> Eff es (f a) |
Run the handler with a given input.
Arguments
| :: forall label providedEs input es a. (HasCallStack, Labeled label (ProviderList_ providedEs input) :> es) | |
| => input | The input to the handler. |
| -> Eff (providedEs ++ es) a | |
| -> Eff es a |
Run the 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 | |
type family (xs :: [Effect]) ++ (ys :: [Effect]) :: [Effect] where ... infixr 5 Source #
Append two type-level lists together.
class Subset subEs es => KnownSubset (subEs :: [Effect]) (es :: [Effect]) Source #
Provide evidence that subEs is a known subset of es.
Instances
| KnownSubset ('[] :: [Effect]) es Source # | |
Defined in Effectful.Internal.Effect | |
| (e :> es, KnownSubset subEs es) => KnownSubset (e ': subEs) es Source # | |
Defined in Effectful.Internal.Effect | |