Copyright | (c) 2023-2024 Sayo Koyoneda |
---|---|
License | MPL-2.0 (see the file LICENSE) |
Maintainer | [email protected] |
Safe Haskell | None |
Language | GHC2021 |
Data.Effect.Provider
Description
This module provides the Provider
effect, like Effectful.Provider
in the effectful
package.
Synopsis
- data Provider' (ctx :: k -> Type -> Type) (i :: k -> Type) (b :: k -> Type -> Type) (f :: Type -> Type) a where
- provide :: forall {k} i (p :: k) b a ctx f. SendHOE (Provider' ctx i b) f => i p -> ((forall x. f x -> b p x) -> b p a) -> f (ctx p a)
- provide' :: forall {k1} (tag :: k1) {k2} i (p :: k2) b a ctx f. SendHOE (TagH (Provider' ctx i b) tag) f => i p -> ((forall x. f x -> b p x) -> b p a) -> f (ctx p a)
- provide'' :: forall {k1} (key :: k1) {k2} i (p :: k2) b a ctx f. SendHOEBy key (Provider' ctx i b) f => i p -> ((forall x. f x -> b p x) -> b p a) -> f (ctx p a)
- data ProviderKey (ctx :: k) (i :: k1)
- type Provider (ctx :: k -> Type -> Type) (i :: k -> Type) (b :: k -> Type -> Type) = ProviderKey ctx i ##> Provider' ctx i b
- type Provider_ i (b :: Type -> Type) = Provider (Const1 Identity :: () -> Type -> Type) (Const i :: () -> Type) (Const1 b :: () -> Type -> Type)
- newtype Const1 (f :: k -> Type) (x :: k1) (a :: k) = Const1 {
- getConst1 :: f a
- newtype Const2 (ff :: k -> k1 -> Type) (x :: k2) (f :: k) (a :: k1) = Const2 {
- getConst2 :: ff f a
- (.!) :: forall {k} i f a b. (SendHOEBy (ProviderKey (Const1 Identity :: () -> Type -> Type) (Const i :: () -> Type)) (Provider' (Const1 Identity :: k -> Type -> Type) (Const i :: k -> Type) (Const1 b :: k -> Type -> Type)) f, Functor f) => i -> ((f ~> b) -> b a) -> f a
- (..!) :: forall {k} ctx i (p :: k) f a b. SendHOEBy (ProviderKey ctx i) (Provider' ctx i b) f => i p -> ((f ~> b p) -> b p a) -> f (ctx p a)
Documentation
data Provider' (ctx :: k -> Type -> Type) (i :: k -> Type) (b :: k -> Type -> Type) (f :: Type -> Type) a where Source #
An effect to introduce a new local scope that provides effect context b
.
Constructors
Provide :: forall {k} (i :: k -> Type) (p :: k) (f :: Type -> Type) (b :: k -> Type -> Type) a1 (ctx :: k -> Type -> Type). i p -> ((forall x. f x -> b p x) -> b p a1) -> Provider' ctx i b f (ctx p a1) | Introduces a new local scope that provides an effect context |
provide :: forall {k} i (p :: k) b a ctx f. SendHOE (Provider' ctx i b) f => i p -> ((forall x. f x -> b p x) -> b p a) -> f (ctx p a) Source #
Introduces a new local scope that provides an effect context b p
parameterized by type i p
and with results wrapped in ctx p
.
provide' :: forall {k1} (tag :: k1) {k2} i (p :: k2) b a ctx f. SendHOE (TagH (Provider' ctx i b) tag) f => i p -> ((forall x. f x -> b p x) -> b p a) -> f (ctx p a) Source #
Introduces a new local scope that provides an effect context b p
parameterized by type i p
and with results wrapped in ctx p
.
provide'' :: forall {k1} (key :: k1) {k2} i (p :: k2) b a ctx f. SendHOEBy key (Provider' ctx i b) f => i p -> ((forall x. f x -> b p x) -> b p a) -> f (ctx p a) Source #
Introduces a new local scope that provides an effect context b p
parameterized by type i p
and with results wrapped in ctx p
.
data ProviderKey (ctx :: k) (i :: k1) Source #
A type-level key to uniquely resolve the effect context carrier b
from ctx
and i
.
type Provider (ctx :: k -> Type -> Type) (i :: k -> Type) (b :: k -> Type -> Type) = ProviderKey ctx i ##> Provider' ctx i b Source #
An effect to introduce a new local scope that provides effect context b
.
type Provider_ i (b :: Type -> Type) = Provider (Const1 Identity :: () -> Type -> Type) (Const i :: () -> Type) (Const1 b :: () -> Type -> Type) Source #
An effect to introduce a new local scope that provides effect context b
.
A version of Provider
where the result is not wrapped in a specific container.
(.!) :: forall {k} i f a b. (SendHOEBy (ProviderKey (Const1 Identity :: () -> Type -> Type) (Const i :: () -> Type)) (Provider' (Const1 Identity :: k -> Type -> Type) (Const i :: k -> Type) (Const1 b :: k -> Type -> Type)) f, Functor f) => i -> ((f ~> b) -> b a) -> f a infix 2 Source #
A operator to introduce a new local scope that provides effect context b
.
A version of ..!
where the result is not wrapped in a specific container.