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

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

Data.Semigroup.Self

Description

A simple `Monoid` transformer that takes a `Monoid` m and produces a new `m`-Reducer named `Self` `m`

This is useful when you have a generator that already contains monoidal values or someone supplies the map to the monoid in the form of a function rather than as a Reducer instance. You can just ``getSelf` . `reduce`` or ``getSelf` . `mapReduce` f` in those scenarios. These behaviors are encapsulated into the `fold` and `foldMap` combinators in Data.Monoid.Combinators respectively.

# Documentation

newtype Self m Source #

Constructors

Self |

Fields

- getSelf :: m

#### Instances

Instances details

Foldable1 Self Source # |

Instance details

Defined in Data.Semigroup.Self

Methods

fold1 :: Semigroup m => Self m -> m Source #

foldMap1 :: Semigroup m => (a -> m) -> Self a -> m Source #

foldMap1' :: Semigroup m => (a -> m) -> Self a -> m Source #

toNonEmpty :: Self a -> NonEmpty a Source #

maximum :: Ord a => Self a -> a Source #

minimum :: Ord a => Self a -> a Source #

head :: Self a -> a Source #

last :: Self a -> a Source #

foldrMap1 :: (a -> b) -> (a -> b -> b) -> Self a -> b Source #

foldlMap1' :: (a -> b) -> (b -> a -> b) -> Self a -> b Source #

foldlMap1 :: (a -> b) -> (b -> a -> b) -> Self a -> b Source #

foldrMap1' :: (a -> b) -> (a -> b -> b) -> Self a -> b Source #

Functor Self Source # |
Instance details Defined in Data.Semigroup.Self Methods fmap :: (a -> b) -> Self a -> Self b Source # (<$) :: a -> Self b -> Self a Source #
Foldable Self Source # |

Instance details

Defined in Data.Semigroup.Self

Methods

fold :: Monoid m => Self m -> m Source #

foldMap :: Monoid m => (a -> m) -> Self a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Self a -> m Source #

foldr :: (a -> b -> b) -> b -> Self a -> b Source #

foldr' :: (a -> b -> b) -> b -> Self a -> b Source #

foldl :: (b -> a -> b) -> b -> Self a -> b Source #

foldl' :: (b -> a -> b) -> b -> Self a -> b Source #

foldr1 :: (a -> a -> a) -> Self a -> a Source #

foldl1 :: (a -> a -> a) -> Self a -> a Source #

toList :: Self a -> [a] Source #

null :: Self a -> Bool Source #

length :: Self a -> Int Source #

elem :: Eq a => a -> Self a -> Bool Source #

maximum :: Ord a => Self a -> a Source #

minimum :: Ord a => Self a -> a Source #

sum :: Num a => Self a -> a Source #

product :: Num a => Self a -> a Source #

Traversable Self Source # |
Instance details Defined in Data.Semigroup.Self Methods traverse :: Applicative f => (a -> f b) -> Self a -> f (Self b) Source # sequenceA :: Applicative f => Self (f a) -> f (Self a) Source # mapM :: Monad m => (a -> m b) -> Self a -> m (Self b) Source # sequence :: Monad m => Self (m a) -> m (Self a) Source #
Traversable1 Self Source # |
Instance details Defined in Data.Semigroup.Self Methods traverse1 :: Apply f => (a -> f b) -> Self a -> f (Self b) Source # sequence1 :: Apply f => Self (f b) -> f (Self b) Source #
Semigroup m => Reducer m (Self m) Source # |
Instance details Defined in Data.Semigroup.Self Methods unit :: m -> Self m Source # snoc :: Self m -> m -> Self m Source # cons :: m -> Self m -> Self m Source #
Monoid m => Monoid (Self m) Source # |
Instance details Defined in Data.Semigroup.Self Methods mempty :: Self m Source # mappend :: Self m -> Self m -> Self m Source # mconcat :: [Self m] -> Self m Source #
Semigroup m => Semigroup (Self m) Source # |
Instance details Defined in Data.Semigroup.Self Methods (<>) :: Self m -> Self m -> Self m Source # sconcat :: NonEmpty (Self m) -> Self m Source # stimes :: Integral b => b -> Self m -> Self m Source #