Data.Semigroup.Monad

reducers-3.12.1: 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 #

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) # |
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) # |
Methods mempty :: Action f # mappend :: Action f -> Action f -> Action f # mconcat :: [Action f] -> Action f #
Monad f => Reducer (f a) (Action f) # |
Methods unit :: f a -> Action f # snoc :: Action f -> f a -> Action f # cons :: f a -> Action f -> Action f #

newtype Mon f m #

Constructors

Mon |
Fields getMon :: f m

Instances

Monad f => Monad (Mon f) # |
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) # |
Methods fmap :: (a -> b) -> Mon f a -> Mon f b # (<$) :: a -> Mon f b -> Mon f a #
Applicative f => Applicative (Mon f) # |
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) # |
Methods unit :: f c -> Mon f m # snoc :: Mon f m -> f c -> Mon f m # cons :: f c -> Mon f m -> Mon f m #
(Monad f, Semigroup m) => Semigroup (Mon f m) # |
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) # |
Methods mempty :: Mon f m # mappend :: Mon f m -> Mon f m -> Mon f m # mconcat :: [Mon f m] -> Mon f m #