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 | portable
Safe Haskell | Trustworthy
Language | Haskell98

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 #

Constructors

Self |
Fields getSelf :: m

Instances

Functor Self # |
Methods fmap :: (a -> b) -> Self a -> Self b # (<$) :: a -> Self b -> Self a #
Foldable Self # |
Methods fold :: Monoid m => Self m -> m # foldMap :: Monoid m => (a -> m) -> Self a -> m # foldr :: (a -> b -> b) -> b -> Self a -> b # foldr' :: (a -> b -> b) -> b -> Self a -> b # foldl :: (b -> a -> b) -> b -> Self a -> b # foldl' :: (b -> a -> b) -> b -> Self a -> b # foldr1 :: (a -> a -> a) -> Self a -> a # foldl1 :: (a -> a -> a) -> Self a -> a # toList :: Self a -> [a] # null :: Self a -> Bool # length :: Self a -> Int # elem :: Eq a => a -> Self a -> Bool # maximum :: Ord a => Self a -> a # minimum :: Ord a => Self a -> a # sum :: Num a => Self a -> a # product :: Num a => Self a -> a #
Traversable Self # |
Methods traverse :: Applicative f => (a -> f b) -> Self a -> f (Self b) # sequenceA :: Applicative f => Self (f a) -> f (Self a) # mapM :: Monad m => (a -> m b) -> Self a -> m (Self b) # sequence :: Monad m => Self (m a) -> m (Self a) #
Traversable1 Self # |
Methods traverse1 :: Apply f => (a -> f b) -> Self a -> f (Self b) # sequence1 :: Apply f => Self (f b) -> f (Self b) #
Foldable1 Self # |
Methods fold1 :: Semigroup m => Self m -> m # foldMap1 :: Semigroup m => (a -> m) -> Self a -> m #
Semigroup m => Reducer m (Self m) # |
Methods unit :: m -> Self m # snoc :: Self m -> m -> Self m # cons :: m -> Self m -> Self m #
Semigroup m => Semigroup (Self m) # |
Methods (<>) :: Self m -> Self m -> Self m # sconcat :: NonEmpty (Self m) -> Self m # stimes :: Integral b => b -> Self m -> Self m #
Monoid m => Monoid (Self m) # |
Methods mempty :: Self m # mappend :: Self m -> Self m -> Self m # mconcat :: [Self m] -> Self m #