| Safe Haskell | None | 
|---|---|
| Language | Haskell2010 | 
Polysemy.Internal.Strategy
Synopsis
- data Strategy m f n z a where- GetInitialState :: Strategy m f n z (f ())
- HoistInterpretation :: (a -> n b) -> Strategy m f n z (f a -> m (f b))
- GetInspector :: Strategy m f n z (Inspector f)
 
- type Strategic m n a = forall f. Functor f => Sem (WithStrategy m f n) (m (f a))
- type WithStrategy m f n = '[Strategy m f n]
- runStrategy :: Functor f => Sem '[Strategy m f n] a -> f () -> (forall x. f (n x) -> m (f x)) -> (forall x. f x -> Maybe x) -> a
- getInspectorS :: forall m f n. Sem (WithStrategy m f n) (Inspector f)
- getInitialStateS :: forall m f n. Sem (WithStrategy m f n) (f ())
- pureS :: Applicative m => a -> Strategic m n a
- liftS :: Functor m => m a -> Strategic m n a
- runS :: n a -> Sem (WithStrategy m f n) (m (f a))
- bindS :: (a -> n b) -> Sem (WithStrategy m f n) (f a -> m (f b))
Documentation
data Strategy m f n z a where Source #
Constructors
| GetInitialState :: Strategy m f n z (f ()) | |
| HoistInterpretation :: (a -> n b) -> Strategy m f n z (f a -> m (f b)) | |
| GetInspector :: Strategy m f n z (Inspector f) | 
type WithStrategy m f n = '[Strategy m f n] Source #
Since: 1.2.0.0
runStrategy :: Functor f => Sem '[Strategy m f n] a -> f () -> (forall x. f (n x) -> m (f x)) -> (forall x. f x -> Maybe x) -> a Source #
Internal function to process Strategies in terms of
 withWeavingToFinal.
Since: 1.2.0.0
getInspectorS :: forall m f n. Sem (WithStrategy m f n) (Inspector f) Source #
Get a natural transformation capable of potentially inspecting values
 inside of f. Binding the result of getInspectorS produces a function that
 can sometimes peek inside values returned by bindS.
This is often useful for running callback functions that are not managed by polysemy code.
See also getInspectorT
Since: 1.2.0.0
getInitialStateS :: forall m f n. Sem (WithStrategy m f n) (f ()) Source #
liftS :: Functor m => m a -> Strategic m n a Source #
Lifts an action of the final monad into Strategic.
Note: you don't need to use this function if you already have a monadic
 action with the functorial state threaded into it, by the use of
 runS or bindS.
 In these cases, you need only use pure to embed the action into the
 Strategic environment.
Since: 1.2.0.0
runS :: n a -> Sem (WithStrategy m f n) (m (f a)) Source #
Lifts a monadic action into the stateful environment, in terms
 of the final monad.
 The stateful environment will be the same as the one that the Strategy
 is initially run in.
Use bindS  if you'd prefer to explicitly manage your stateful environment.
Since: 1.2.0.0
bindS :: (a -> n b) -> Sem (WithStrategy m f n) (f a -> m (f b)) Source #