Copyright | (c) 2023-2025 Sayo contributors |
---|---|
License | MPL-2.0 (see the file LICENSE) |
Maintainer | ymdfield@outlook.jp |
Safe Haskell | None |
Language | GHC2021 |
Data.Effect.Provider
Description
This module provides the Provider
effect, like Effectful.Provider
in the effectful
package.
Synopsis
- data Scope (t :: k -> Type -> Type) (i :: k -> Type) (b :: k -> Type -> Type) (a :: Type -> Type) c where
- scope :: forall {k} (s :: k) t i a b f (es :: [Effect]) (ff :: (Type -> Type) -> Type -> Type) (c :: (Type -> Type) -> Constraint). (Free c ff, f ~ Eff ff es, Scope t i b :> es) => i s -> ((forall x. f x -> b s x) -> b s a) -> f (t s a)
- scope' :: forall {k1} (key :: k1) {k2} (s :: k2) t i a b f (es :: [Effect]) (ff :: (Type -> Type) -> Type -> Type) (c :: (Type -> Type) -> Constraint). (Free c ff, f ~ Eff ff es, Has key (Scope t i b) es) => i s -> ((forall x. f x -> b s x) -> b s a) -> f (t s a)
- scope'' :: forall {k1} (tag :: k1) {k2} (s :: k2) t i a b f (es :: [Effect]) (ff :: (Type -> Type) -> Type -> Type) (c :: (Type -> Type) -> Constraint). (Free c ff, f ~ Eff ff es, Tagged tag (Scope t i b) :> es) => i s -> ((forall x. f x -> b s x) -> b s a) -> f (t s a)
- scope'_ :: forall {k} (s :: k) t i a b f (es :: [Effect]) (ff :: (Type -> Type) -> Type -> Type) (c :: (Type -> Type) -> Constraint). (Free c ff, f ~ Eff ff es, In (Scope t i b) es) => i s -> ((forall x. f x -> b s x) -> b s a) -> f (t s a)
- data ScopeLabel (t :: k -> Type -> Type) (i :: k -> Type)
- newtype Const1 (f :: Type -> Type) (x :: k) a = Const1 {
- getConst1 :: f a
- type Scoped (ff :: (Type -> Type) -> Type -> Type) (t :: k -> Type -> Type) (i :: k -> Type) (es :: [k -> Effect]) (r :: [Effect]) = Scope t i (ScopeC ff t i es r)
- newtype ScopeC (ff :: (Type -> Type) -> Type -> Type) (t :: k -> Type -> Type) (i :: k -> Type) (fs :: [k -> Effect]) (r :: [Effect]) (s :: k) a = ScopeC {}
- type Scoped_ (ff :: (Type -> Type) -> Type -> Type) (t :: k -> Type -> Type) (i :: k -> Type) (es :: [Effect]) (r :: [Effect]) = Scope t i (Const1 (ScopeC_ ff t i es r) :: k -> Type -> Type)
- newtype ScopeC_ (ff :: (Type -> Type) -> Type -> Type) (t :: k -> Type -> Type) (i :: k -> Type) (es :: [Effect]) (r :: [Effect]) a = ScopeC_ {}
- type Provider (ff :: (Type -> Type) -> Type -> Type) (t :: Type -> Type) i (e :: [Effect]) (es :: [Effect]) = Scoped_ ff (Const1 t :: () -> Type -> Type) (Const i :: () -> Type) e es
- runScoped :: forall {k} t i a (es :: [k -> Effect]) (r :: [Effect]) (ff :: (Type -> Type) -> Type -> Type) (c :: (Type -> Type) -> Constraint). (KnownLength es, Free c ff) => (forall (s :: k) x. i s -> Eff ff (Each es s ++ (Scoped ff t i es r ': r)) x -> Eff ff (Scoped ff t i es r ': r) (t s x)) -> Eff ff (Scoped ff t i es r ': r) a -> Eff ff r a
- runRegionScoped :: forall {k} (b :: Type -> Type) t i a (es :: [k -> Effect]) (r :: [Effect]) (ff :: (Type -> Type) -> Type -> Type) (c :: (Type -> Type) -> Constraint). (WeakenExps r, UnliftBase b :> r, Emb b :> RemoveExps r, KnownLength es, Free c ff) => (forall (s :: k) x. i s -> Eff ff (Each es s ++ (Scoped ff t i es (RemoveExps r) ': r)) x -> Eff ff (Scoped ff t i es (RemoveExps r) ': r) (t s x)) -> Eff ff (Scoped ff t i es (RemoveExps r) ': r) a -> Eff ff r a
- scoped :: forall {k} t i (s :: k) a (es' :: [Effect]) (es :: [k -> Effect]) (r :: [Effect]) (ff :: (Type -> Type) -> Type -> Type) (c :: (Type -> Type) -> Constraint). (Scoped ff t i es r :> es', Free c ff) => i s -> ((Eff ff es' ~> Eff ff (Each es s ++ (Scoped ff t i es r ': r))) -> Eff ff (Each es s ++ (Scoped ff t i es r ': r)) a) -> Eff ff es' (t s a)
- runScoped_ :: forall {k} t i a (es :: [Effect]) (r :: [Effect]) (ff :: (Type -> Type) -> Type -> Type) (c :: (Type -> Type) -> Constraint). (KnownLength es, Free c ff) => (forall (p :: k) x. i p -> Eff ff (es ++ (Scoped_ ff t i es r ': r)) x -> Eff ff (Scoped_ ff t i es r ': r) (t p x)) -> Eff ff (Scoped_ ff t i es r ': r) a -> Eff ff r a
- runRegionScoped_ :: forall {k} (b :: Type -> Type) t i a (es :: [Effect]) (r :: [Effect]) (ff :: (Type -> Type) -> Type -> Type) (c :: (Type -> Type) -> Constraint). (WeakenExps r, UnliftBase b :> r, Emb b :> RemoveExps r, KnownLength es, Free c ff) => (forall (p :: k) x. i p -> Eff ff (es ++ (Scoped_ ff t i es (RemoveExps r) ': r)) x -> Eff ff (Scoped_ ff t i es (RemoveExps r) ': r) (t p x)) -> Eff ff (Scoped_ ff t i es (RemoveExps r) ': r) a -> Eff ff r a
- scoped_ :: forall {k} t i (s :: k) a (es' :: [Effect]) (es :: [Effect]) (r :: [Effect]) (ff :: (Type -> Type) -> Type -> Type) (c :: (Type -> Type) -> Constraint). (Scoped_ ff t i es r :> es', Free c ff) => i s -> ((Eff ff es' ~> Eff ff (es ++ (Scoped_ ff t i es r ': r))) -> Eff ff (es ++ (Scoped_ ff t i es r ': r)) a) -> Eff ff es' (t s a)
- runProvider :: forall t i a (es :: [Effect]) (r :: [Effect]) (ff :: (Type -> Type) -> Type -> Type) (c :: (Type -> Type) -> Constraint). (forall (es' :: [Effect]). Functor (Eff ff es'), KnownLength es, Free c ff) => (forall x. i -> Eff ff (es ++ (Provider ff t i es r ': r)) x -> Eff ff (Provider ff t i es r ': r) (t x)) -> Eff ff (Provider ff t i es r ': r) a -> Eff ff r a
- runRegionProvider :: forall (b :: Type -> Type) t i a (es :: [Effect]) (r :: [Effect]) (ff :: (Type -> Type) -> Type -> Type) (c :: (Type -> Type) -> Constraint). (WeakenExps r, UnliftBase b :> r, Emb b :> RemoveExps r, forall (es' :: [Effect]). Functor (Eff ff es'), KnownLength es, Free c ff) => (forall x. i -> Eff ff (es ++ (Provider ff t i es (RemoveExps r) ': r)) x -> Eff ff (Provider ff t i es (RemoveExps r) ': r) (t x)) -> Eff ff (Provider ff t i es (RemoveExps r) ': r) a -> Eff ff r a
- provide :: forall t i a (es' :: [Effect]) (es :: [Effect]) (r :: [Effect]) (ff :: (Type -> Type) -> Type -> Type) (c :: (Type -> Type) -> Constraint). (Provider ff t i es r :> es', forall (es'' :: [Effect]). Functor (Eff ff es''), Free c ff) => i -> ((Eff ff es' ~> Eff ff (es ++ (Provider ff t i es r ': r))) -> Eff ff (es ++ (Provider ff t i es r ': r)) a) -> Eff ff es' (t a)
- runProvider_ :: forall i a (es :: [Effect]) (r :: [Effect]) (ff :: (Type -> Type) -> Type -> Type) (c :: (Type -> Type) -> Constraint). (forall (es' :: [Effect]). Functor (Eff ff es'), KnownLength es, Free c ff) => (forall x. i -> Eff ff (es ++ (Provider ff Identity i es r ': r)) x -> Eff ff (Provider ff Identity i es r ': r) x) -> Eff ff (Provider ff Identity i es r ': r) a -> Eff ff r a
- runRegionProvider_ :: forall (b :: Type -> Type) i a (es :: [Effect]) (r :: [Effect]) (ff :: (Type -> Type) -> Type -> Type) (c :: (Type -> Type) -> Constraint). (WeakenExps r, UnliftBase b :> r, Emb b :> RemoveExps r, forall (es' :: [Effect]). Functor (Eff ff es'), KnownLength es, Free c ff) => (forall x. i -> Eff ff (es ++ (Provider ff Identity i es (RemoveExps r) ': r)) x -> Eff ff (Provider ff Identity i es (RemoveExps r) ': r) x) -> Eff ff (Provider ff Identity i es (RemoveExps r) ': r) a -> Eff ff r a
- provide_ :: forall i a (es' :: [Effect]) (es :: [Effect]) (r :: [Effect]) (ff :: (Type -> Type) -> Type -> Type) (c :: (Type -> Type) -> Constraint). (Provider ff Identity i es r :> es', forall (es'' :: [Effect]). Functor (Eff ff es''), Free c ff) => i -> ((Eff ff es' ~> Eff ff (es ++ (Provider ff Identity i es r ': r))) -> Eff ff (es ++ (Provider ff Identity i es r ': r)) a) -> Eff ff es' a
- runProvider__ :: forall a (es :: [Effect]) (r :: [Effect]) (ff :: (Type -> Type) -> Type -> Type) (c :: (Type -> Type) -> Constraint). (forall (es' :: [Effect]). Functor (Eff ff es'), KnownLength es, Free c ff) => (forall x. Eff ff (es ++ (Provider ff Identity () es r ': r)) x -> Eff ff (Provider ff Identity () es r ': r) x) -> Eff ff (Provider ff Identity () es r ': r) a -> Eff ff r a
- runRegionProvider__ :: forall (b :: Type -> Type) a (es :: [Effect]) (r :: [Effect]) (ff :: (Type -> Type) -> Type -> Type) (c :: (Type -> Type) -> Constraint). (WeakenExps r, UnliftBase b :> r, Emb b :> RemoveExps r, forall (es' :: [Effect]). Functor (Eff ff es'), KnownLength es, Free c ff) => (forall x. Eff ff (es ++ (Provider ff Identity () es (RemoveExps r) ': r)) x -> Eff ff (Provider ff Identity () es (RemoveExps r) ': r) x) -> Eff ff (Provider ff Identity () es (RemoveExps r) ': r) a -> Eff ff r a
- provide__ :: forall a (es' :: [Effect]) (es :: [Effect]) (r :: [Effect]) (ff :: (Type -> Type) -> Type -> Type) (c :: (Type -> Type) -> Constraint). (Provider ff Identity () es r :> es', forall (es'' :: [Effect]). Functor (Eff ff es''), Free c ff) => ((Eff ff es' ~> Eff ff (es ++ (Provider ff Identity () es r ': r))) -> Eff ff (es ++ (Provider ff Identity () es r ': r)) a) -> Eff ff es' a
Documentation
data Scope (t :: k -> Type -> Type) (i :: k -> Type) (b :: k -> Type -> Type) (a :: Type -> Type) c where Source #
An effect to introduce a new local scope that provides effect context b s
.
Constructors
Scope :: forall {k} (s :: k) (t :: k -> Type -> Type) (i :: k -> Type) a1 (a :: Type -> Type) (b :: k -> Type -> Type). i s -> ((forall x. a x -> b s x) -> b s a1) -> Scope t i b a (t s a1) | Introduces a new local scope that provides an effect context |
Instances
HFunctor (Scope t i b) Source # | |
Defined in Data.Effect.Provider | |
type FormOf (Scope t i b) Source # | |
Defined in Data.Effect.Provider | |
type LabelOf (Scope t i b) Source # | |
Defined in Data.Effect.Provider | |
type OrderOf (Scope t i b) Source # | |
Defined in Data.Effect.Provider |
scope :: forall {k} (s :: k) t i a b f (es :: [Effect]) (ff :: (Type -> Type) -> Type -> Type) (c :: (Type -> Type) -> Constraint). (Free c ff, f ~ Eff ff es, Scope t i b :> es) => i s -> ((forall x. f x -> b s x) -> b s a) -> f (t s a) Source #
Introduces a new local scope that provides an effect context b s
parameterized by type i s
and with results wrapped in t s
.
scope' :: forall {k1} (key :: k1) {k2} (s :: k2) t i a b f (es :: [Effect]) (ff :: (Type -> Type) -> Type -> Type) (c :: (Type -> Type) -> Constraint). (Free c ff, f ~ Eff ff es, Has key (Scope t i b) es) => i s -> ((forall x. f x -> b s x) -> b s a) -> f (t s a) Source #
Introduces a new local scope that provides an effect context b s
parameterized by type i s
and with results wrapped in t s
.
scope'' :: forall {k1} (tag :: k1) {k2} (s :: k2) t i a b f (es :: [Effect]) (ff :: (Type -> Type) -> Type -> Type) (c :: (Type -> Type) -> Constraint). (Free c ff, f ~ Eff ff es, Tagged tag (Scope t i b) :> es) => i s -> ((forall x. f x -> b s x) -> b s a) -> f (t s a) Source #
Introduces a new local scope that provides an effect context b s
parameterized by type i s
and with results wrapped in t s
.
scope'_ :: forall {k} (s :: k) t i a b f (es :: [Effect]) (ff :: (Type -> Type) -> Type -> Type) (c :: (Type -> Type) -> Constraint). (Free c ff, f ~ Eff ff es, In (Scope t i b) es) => i s -> ((forall x. f x -> b s x) -> b s a) -> f (t s a) Source #
Introduces a new local scope that provides an effect context b s
parameterized by type i s
and with results wrapped in t s
.
data ScopeLabel (t :: k -> Type -> Type) (i :: k -> Type) Source #
A type-level label to uniquely resolve the effect context carrier b
from t
and i
.
type Scoped (ff :: (Type -> Type) -> Type -> Type) (t :: k -> Type -> Type) (i :: k -> Type) (es :: [k -> Effect]) (r :: [Effect]) = Scope t i (ScopeC ff t i es r) Source #
An effect to introduce a new local scope that provides the scope-parametrized effect es
.
newtype ScopeC (ff :: (Type -> Type) -> Type -> Type) (t :: k -> Type -> Type) (i :: k -> Type) (fs :: [k -> Effect]) (r :: [Effect]) (s :: k) a Source #
type Scoped_ (ff :: (Type -> Type) -> Type -> Type) (t :: k -> Type -> Type) (i :: k -> Type) (es :: [Effect]) (r :: [Effect]) = Scope t i (Const1 (ScopeC_ ff t i es r) :: k -> Type -> Type) Source #
An effect to introduce a new local scope that provides the effect es
.
newtype ScopeC_ (ff :: (Type -> Type) -> Type -> Type) (t :: k -> Type -> Type) (i :: k -> Type) (es :: [Effect]) (r :: [Effect]) a Source #
type Provider (ff :: (Type -> Type) -> Type -> Type) (t :: Type -> Type) i (e :: [Effect]) (es :: [Effect]) = Scoped_ ff (Const1 t :: () -> Type -> Type) (Const i :: () -> Type) e es Source #
runScoped :: forall {k} t i a (es :: [k -> Effect]) (r :: [Effect]) (ff :: (Type -> Type) -> Type -> Type) (c :: (Type -> Type) -> Constraint). (KnownLength es, Free c ff) => (forall (s :: k) x. i s -> Eff ff (Each es s ++ (Scoped ff t i es r ': r)) x -> Eff ff (Scoped ff t i es r ': r) (t s x)) -> Eff ff (Scoped ff t i es r ': r) a -> Eff ff r a Source #
runRegionScoped :: forall {k} (b :: Type -> Type) t i a (es :: [k -> Effect]) (r :: [Effect]) (ff :: (Type -> Type) -> Type -> Type) (c :: (Type -> Type) -> Constraint). (WeakenExps r, UnliftBase b :> r, Emb b :> RemoveExps r, KnownLength es, Free c ff) => (forall (s :: k) x. i s -> Eff ff (Each es s ++ (Scoped ff t i es (RemoveExps r) ': r)) x -> Eff ff (Scoped ff t i es (RemoveExps r) ': r) (t s x)) -> Eff ff (Scoped ff t i es (RemoveExps r) ': r) a -> Eff ff r a Source #
scoped :: forall {k} t i (s :: k) a (es' :: [Effect]) (es :: [k -> Effect]) (r :: [Effect]) (ff :: (Type -> Type) -> Type -> Type) (c :: (Type -> Type) -> Constraint). (Scoped ff t i es r :> es', Free c ff) => i s -> ((Eff ff es' ~> Eff ff (Each es s ++ (Scoped ff t i es r ': r))) -> Eff ff (Each es s ++ (Scoped ff t i es r ': r)) a) -> Eff ff es' (t s a) Source #
runScoped_ :: forall {k} t i a (es :: [Effect]) (r :: [Effect]) (ff :: (Type -> Type) -> Type -> Type) (c :: (Type -> Type) -> Constraint). (KnownLength es, Free c ff) => (forall (p :: k) x. i p -> Eff ff (es ++ (Scoped_ ff t i es r ': r)) x -> Eff ff (Scoped_ ff t i es r ': r) (t p x)) -> Eff ff (Scoped_ ff t i es r ': r) a -> Eff ff r a Source #
runRegionScoped_ :: forall {k} (b :: Type -> Type) t i a (es :: [Effect]) (r :: [Effect]) (ff :: (Type -> Type) -> Type -> Type) (c :: (Type -> Type) -> Constraint). (WeakenExps r, UnliftBase b :> r, Emb b :> RemoveExps r, KnownLength es, Free c ff) => (forall (p :: k) x. i p -> Eff ff (es ++ (Scoped_ ff t i es (RemoveExps r) ': r)) x -> Eff ff (Scoped_ ff t i es (RemoveExps r) ': r) (t p x)) -> Eff ff (Scoped_ ff t i es (RemoveExps r) ': r) a -> Eff ff r a Source #
scoped_ :: forall {k} t i (s :: k) a (es' :: [Effect]) (es :: [Effect]) (r :: [Effect]) (ff :: (Type -> Type) -> Type -> Type) (c :: (Type -> Type) -> Constraint). (Scoped_ ff t i es r :> es', Free c ff) => i s -> ((Eff ff es' ~> Eff ff (es ++ (Scoped_ ff t i es r ': r))) -> Eff ff (es ++ (Scoped_ ff t i es r ': r)) a) -> Eff ff es' (t s a) Source #
runProvider :: forall t i a (es :: [Effect]) (r :: [Effect]) (ff :: (Type -> Type) -> Type -> Type) (c :: (Type -> Type) -> Constraint). (forall (es' :: [Effect]). Functor (Eff ff es'), KnownLength es, Free c ff) => (forall x. i -> Eff ff (es ++ (Provider ff t i es r ': r)) x -> Eff ff (Provider ff t i es r ': r) (t x)) -> Eff ff (Provider ff t i es r ': r) a -> Eff ff r a Source #
runRegionProvider :: forall (b :: Type -> Type) t i a (es :: [Effect]) (r :: [Effect]) (ff :: (Type -> Type) -> Type -> Type) (c :: (Type -> Type) -> Constraint). (WeakenExps r, UnliftBase b :> r, Emb b :> RemoveExps r, forall (es' :: [Effect]). Functor (Eff ff es'), KnownLength es, Free c ff) => (forall x. i -> Eff ff (es ++ (Provider ff t i es (RemoveExps r) ': r)) x -> Eff ff (Provider ff t i es (RemoveExps r) ': r) (t x)) -> Eff ff (Provider ff t i es (RemoveExps r) ': r) a -> Eff ff r a Source #
provide :: forall t i a (es' :: [Effect]) (es :: [Effect]) (r :: [Effect]) (ff :: (Type -> Type) -> Type -> Type) (c :: (Type -> Type) -> Constraint). (Provider ff t i es r :> es', forall (es'' :: [Effect]). Functor (Eff ff es''), Free c ff) => i -> ((Eff ff es' ~> Eff ff (es ++ (Provider ff t i es r ': r))) -> Eff ff (es ++ (Provider ff t i es r ': r)) a) -> Eff ff es' (t a) Source #
runProvider_ :: forall i a (es :: [Effect]) (r :: [Effect]) (ff :: (Type -> Type) -> Type -> Type) (c :: (Type -> Type) -> Constraint). (forall (es' :: [Effect]). Functor (Eff ff es'), KnownLength es, Free c ff) => (forall x. i -> Eff ff (es ++ (Provider ff Identity i es r ': r)) x -> Eff ff (Provider ff Identity i es r ': r) x) -> Eff ff (Provider ff Identity i es r ': r) a -> Eff ff r a Source #
runRegionProvider_ :: forall (b :: Type -> Type) i a (es :: [Effect]) (r :: [Effect]) (ff :: (Type -> Type) -> Type -> Type) (c :: (Type -> Type) -> Constraint). (WeakenExps r, UnliftBase b :> r, Emb b :> RemoveExps r, forall (es' :: [Effect]). Functor (Eff ff es'), KnownLength es, Free c ff) => (forall x. i -> Eff ff (es ++ (Provider ff Identity i es (RemoveExps r) ': r)) x -> Eff ff (Provider ff Identity i es (RemoveExps r) ': r) x) -> Eff ff (Provider ff Identity i es (RemoveExps r) ': r) a -> Eff ff r a Source #
provide_ :: forall i a (es' :: [Effect]) (es :: [Effect]) (r :: [Effect]) (ff :: (Type -> Type) -> Type -> Type) (c :: (Type -> Type) -> Constraint). (Provider ff Identity i es r :> es', forall (es'' :: [Effect]). Functor (Eff ff es''), Free c ff) => i -> ((Eff ff es' ~> Eff ff (es ++ (Provider ff Identity i es r ': r))) -> Eff ff (es ++ (Provider ff Identity i es r ': r)) a) -> Eff ff es' a Source #
runProvider__ :: forall a (es :: [Effect]) (r :: [Effect]) (ff :: (Type -> Type) -> Type -> Type) (c :: (Type -> Type) -> Constraint). (forall (es' :: [Effect]). Functor (Eff ff es'), KnownLength es, Free c ff) => (forall x. Eff ff (es ++ (Provider ff Identity () es r ': r)) x -> Eff ff (Provider ff Identity () es r ': r) x) -> Eff ff (Provider ff Identity () es r ': r) a -> Eff ff r a Source #
runRegionProvider__ :: forall (b :: Type -> Type) a (es :: [Effect]) (r :: [Effect]) (ff :: (Type -> Type) -> Type -> Type) (c :: (Type -> Type) -> Constraint). (WeakenExps r, UnliftBase b :> r, Emb b :> RemoveExps r, forall (es' :: [Effect]). Functor (Eff ff es'), KnownLength es, Free c ff) => (forall x. Eff ff (es ++ (Provider ff Identity () es (RemoveExps r) ': r)) x -> Eff ff (Provider ff Identity () es (RemoveExps r) ': r) x) -> Eff ff (Provider ff Identity () es (RemoveExps r) ': r) a -> Eff ff r a Source #
provide__ :: forall a (es' :: [Effect]) (es :: [Effect]) (r :: [Effect]) (ff :: (Type -> Type) -> Type -> Type) (c :: (Type -> Type) -> Constraint). (Provider ff Identity () es r :> es', forall (es'' :: [Effect]). Functor (Eff ff es''), Free c ff) => ((Eff ff es' ~> Eff ff (es ++ (Provider ff Identity () es r ': r))) -> Eff ff (es ++ (Provider ff Identity () es r ': r)) a) -> Eff ff es' a Source #