reducers-3.12.2: Semigroups, specialized containers and a general map/reduce framework

Copyright | (c) Edward Kmett 2009
License | BSD-style
Maintainer | ekmett@gmail.com
Stability | experimental
Portability | non-portable (MPTCs)
Safe Haskell | Trustworthy
Language | Haskell98

Data.Semigroup.Monad

Description

Semigroups for working with `Monad`s.

Synopsis

- newtype Action f = Action {
  - getAction :: f ()
  }
- newtype Mon f m = Mon {
  - getMon :: f m
  }

# Documentation

newtype Action f Source #

A `Action` uses an glues together monadic actions with (>>) in the manner of `mapM_` from Data.Foldable. Any values returned by reduced actions are discarded.

Constructors

Action |

Fields

- getAction :: f ()

Instances

Monad f => Semigroup (Action f) Source # |
Methods (<>) :: Action f -> Action f -> Action f # sconcat :: NonEmpty (Action f) -> Action f # stimes :: Integral b => b -> Action f -> Action f #
Monad f => Monoid (Action f) Source # |
Methods mempty :: Action f # mappend :: Action f -> Action f -> Action f # mconcat :: [Action f] -> Action f #
Monad f => Reducer (f a) (Action f) Source # |
Methods unit :: f a -> Action f Source # snoc :: Action f -> f a -> Action f Source # cons :: f a -> Action f -> Action f Source #

newtype Mon f m Source #

Constructors

Mon |

Fields

- getMon :: f m

Instances

Monad f => Monad (Mon f) Source # |
Methods (>>=) :: Mon f a -> (a -> Mon f b) -> Mon f b # (>>) :: Mon f a -> Mon f b -> Mon f b # return :: a -> Mon f a # fail :: String -> Mon f a #
Functor f => Functor (Mon f) Source # |
Methods fmap :: (a -> b) -> Mon f a -> Mon f b # (<$) :: a -> Mon f b -> Mon f a #
Applicative f => Applicative (Mon f) Source # |
Methods pure :: a -> Mon f a # (<*>) :: Mon f (a -> b) -> Mon f a -> Mon f b # (*>) :: Mon f a -> Mon f b -> Mon f b # (<*) :: Mon f a -> Mon f b -> Mon f a #
(Monad f, Reducer c m) => Reducer (f c) (Mon f m) Source # |
Methods unit :: f c -> Mon f m Source # snoc :: Mon f m -> f c -> Mon f m Source # cons :: f c -> Mon f m -> Mon f m Source #
(Monad f, Semigroup m) => Semigroup (Mon f m) Source # |
Methods (<>) :: Mon f m -> Mon f m -> Mon f m # sconcat :: NonEmpty (Mon f m) -> Mon f m # stimes :: Integral b => b -> Mon f m -> Mon f m #
(Monad f, Monoid m) => Monoid (Mon f m) Source # |
Methods mempty :: Mon f m # mappend :: Mon f m -> Mon f m -> Mon f m # mconcat :: [Mon f m] -> Mon f m #