Portability | MTPCs, FDs, Rank2 |
---|---|

Stability | experimental |

Maintainer | Edward Kmett <ekmett@gmail.com> |

Safe Haskell | None |

- type Action m a c = forall f r. Effective m r f => (c -> f c) -> a -> f a
- act :: Monad m => (a -> m c) -> Action m a c
- acts :: Action m (m a) a
- perform :: Monad m => Acting m c a b c d -> a -> m c
- performs :: Monad m => Acting m e a b c d -> (c -> e) -> a -> m e
- liftAct :: (MonadTrans t, Monad m) => Acting m c a b c d -> Action (t m) a c
- (^!) :: Monad m => a -> Acting m c a b c d -> m c
- type MonadicFold m a c = forall f r. (Effective m r f, Applicative f) => (c -> f c) -> a -> f a
- type Acting m r a b c d = (c -> Effect m r d) -> a -> Effect m r b

# Composable Actions

performs :: Monad m => Acting m e a b c d -> (c -> e) -> a -> m eSource

Perform an `Action`

and modify the result.

(^!) :: Monad m => a -> Acting m c a b c d -> m cSource

Perform an `Action`

`>>>`

hello world`["hello","world"]^!folded.act putStrLn`

# Folds with Effecs

type MonadicFold m a c = forall f r. (Effective m r f, Applicative f) => (c -> f c) -> a -> f aSource

A `MonadicFold`

is a `Fold`

enriched with access to a `Monad`

for side-effects.

Every `Fold`

can be used as a `MonadicFold`

, that simply ignores the access to the `Monad`

.

You can compose a `MonadicFold`

with another `MonadicFold`

using (`.`

) from the `Prelude`

.