| License | MIT |
|---|---|
| Stability | experimental |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Polysemy.Uncontrolled
Description
Uncontrolled is the dual of Methodology. Where a `Methodology b c`
represents a way to turn b into c in a controlled decomposition,
Uncontrolled represents a purely unknown side effect - that materialises
bs out of nowhere, and sends cs into the void where we have no knowledge
of what happens to them. This is equivalent to the combination of Input
and Output considered as a single unit.
Synopsis
- data Uncontrolled c b m a where
- Send :: c -> Uncontrolled c b m ()
- Receive :: Uncontrolled c b m b
- send :: forall c b r. Member (Uncontrolled c b) r => c -> Sem r ()
- receive :: forall c b r. Member (Uncontrolled c b) r => Sem r b
- runUncontrolledAsState :: forall s b c r a. Members '[State s] r => (c -> s) -> (s -> b) -> Sem (Uncontrolled c b ': r) a -> Sem r a
- runUncontrolledAsStateSem :: forall s b c r a. Members '[State s] r => (c -> Sem r s) -> (s -> Sem r b) -> Sem (Uncontrolled c b ': r) a -> Sem r a
- runUncontrolledAsInputOutput :: Members '[Input b, Output c] r => Sem (Uncontrolled c b ': r) a -> Sem r a
- adaptUncontrolledPure :: Members '[Uncontrolled c' b'] r => (c -> c') -> (b' -> b) -> Sem (Uncontrolled c b ': r) a -> Sem r a
- adaptUncontrolledSem :: forall c b c' b' r a. Members '[Uncontrolled c' b'] r => (c -> Sem r c') -> (b' -> Sem r b) -> Sem (Uncontrolled c b ': r) a -> Sem r a
- runInputAsUncontrolled :: forall c b r a. Members '[Uncontrolled c b] r => Sem (Input b ': r) a -> Sem r a
- runOutputAsUncontrolled :: forall c b r a. Members '[Uncontrolled c b] r => Sem (Output c ': r) a -> Sem r a
- runMethodologyAsUncontrolled :: forall c b r a. Members '[Uncontrolled b c] r => Sem (Methodology b c ': r) a -> Sem r a
Definition
data Uncontrolled c b m a where Source #
An Uncontrolled generalises an unmanaged side effect.
Since: 0.1.0.0
Constructors
| Send :: c -> Uncontrolled c b m () | |
| Receive :: Uncontrolled c b m b |
Eliminators
runUncontrolledAsState :: forall s b c r a. Members '[State s] r => (c -> s) -> (s -> b) -> Sem (Uncontrolled c b ': r) a -> Sem r a Source #
Run an Uncontrolled as State, using a neutral element and accessors.
Since: 0.1.0.0
runUncontrolledAsStateSem :: forall s b c r a. Members '[State s] r => (c -> Sem r s) -> (s -> Sem r b) -> Sem (Uncontrolled c b ': r) a -> Sem r a Source #
Like runUncontrolledAsState, but uses monadic accessors.
Since: 0.1.0.0
runUncontrolledAsInputOutput :: Members '[Input b, Output c] r => Sem (Uncontrolled c b ': r) a -> Sem r a Source #
Run an Uncontrolled as an Input/Output pair.
Since: 0.1.0.0
Adapters
adaptUncontrolledPure :: Members '[Uncontrolled c' b'] r => (c -> c') -> (b' -> b) -> Sem (Uncontrolled c b ': r) a -> Sem r a Source #
Run an Uncontrolled as another kind of Uncontrolled, using pure functions to dimap from one to the other.
Since: 0.1.0.0
adaptUncontrolledSem :: forall c b c' b' r a. Members '[Uncontrolled c' b'] r => (c -> Sem r c') -> (b' -> Sem r b) -> Sem (Uncontrolled c b ': r) a -> Sem r a Source #
Like adaptUncontrolledPure, but with monadic adapters.
Since: 0.1.0.0
Coeliminators
runInputAsUncontrolled :: forall c b r a. Members '[Uncontrolled c b] r => Sem (Input b ': r) a -> Sem r a Source #
Run an Input as one side of an Uncontrolled.
Since: 0.1.0.0
runOutputAsUncontrolled :: forall c b r a. Members '[Uncontrolled c b] r => Sem (Output c ': r) a -> Sem r a Source #
Run an Output as one side of an Uncontrolled.
Since: 0.1.0.0
runMethodologyAsUncontrolled :: forall c b r a. Members '[Uncontrolled b c] r => Sem (Methodology b c ': r) a -> Sem r a Source #
Run a Methodology as an Uncontrolled pure side effect.
Since: 0.1.0.0