polysemy-extra-0.1.1.0: Extra Input and Output functions for polysemy..
Safe HaskellNone
LanguageHaskell2010

Polysemy.Extra

Synopsis

Documentation

runKVStoreAsKVStore :: forall k v k' v' r a. (k -> k') -> (v -> v') -> (v' -> v) -> Sem (KVStore k v ': r) a -> Sem (KVStore k' v' ': r) a Source #

Run a KVStore in terms of another KVStore by way of pure key and value transformations.

runKVStoreAsKVStoreSem :: forall k v k' v' r a. Members '[KVStore k' v'] r => (k -> Sem r k') -> (v -> Sem r v') -> (v' -> Sem r v) -> Sem (KVStore k v ': r) a -> Sem r a Source #

Run a KVStore in terms of another KVStore by way of transforming the keys and values with Sem functions.

runOutputMapAsKVStore :: Members '[KVStore k v] r => Sem (Output (Map k v) ': r) a -> Sem r a Source #

Run an `Output (Map k v)` as a KVStore by writing the values to the keys.

mapOutput :: Members '[Output o'] r => (o -> o') -> Sem (Output o ': r) a -> Sem r a Source #

Map an Output forwards

mapOutputSem :: Members '[Output o'] r => (o -> Sem r o') -> Sem (Output o ': r) a -> Sem r a Source #

Map an Output forwards through a monadic function.

contramapInput :: forall i i' r a. Members '[Input i'] r => (i' -> i) -> Sem (Input i ': r) a -> Sem r a Source #

Map an Input contravariantly.

contramapInputSem :: forall i i' r a. Members '[Input i'] r => (i' -> Sem r i) -> Sem (Input i ': r) a -> Sem r a Source #

Map an Input contravariantly through a monadic function.

reinterpretUnder :: forall e1 e2 e3 r a. (forall m x. Sem (e2 ': m) x -> Sem (e3 ': m) x) -> Sem (e1 ': (e2 ': r)) a -> Sem (e1 ': (e3 ': r)) a Source #

Reinterpret the second effect in the stack into a single effect.

reinterpretUnder2 :: forall e1 e2 e3 e4 r a. (forall m x. Sem (e3 ': m) x -> Sem (e4 ': m) x) -> Sem (e1 ': (e2 ': (e3 ': r))) a -> Sem (e1 ': (e2 ': (e4 ': r))) a Source #

Reinterpret the third effect in the stack into a single effect.

reinterpret2Under :: forall e1 e2 e3 e4 r a. (forall m x. Sem (e2 ': m) x -> Sem (e3 ': (e4 ': m)) x) -> Sem (e1 ': (e2 ': r)) a -> Sem (e1 ': (e3 ': (e4 ': r))) a Source #

Reinterpret the second effect in the stack in terms of two effects.