reducers-3.12.4: Semigroups, specialized containers and a general map/reduce framework
Copyright(c) Edward Kmett 2009
LicenseBSD-style
Maintainerekmett@gmail.com
Stabilityexperimental
Portabilityportable
Safe HaskellTrustworthy
LanguageHaskell2010

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

Instances

Instances details
Functor Self Source # 
Instance details

Defined in Data.Semigroup.Self

Methods

fmap :: (a -> b) -> Self a -> Self b #

(<$) :: a -> Self b -> Self a #

Foldable Self Source # 
Instance details

Defined in Data.Semigroup.Self

Methods

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

foldMap :: Monoid m => (a -> m) -> Self a -> 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 Source # 
Instance details

Defined in Data.Semigroup.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 Source # 
Instance details

Defined in Data.Semigroup.Self

Methods

traverse1 :: Apply f => (a -> f b) -> Self a -> f (Self b) #

sequence1 :: Apply f => Self (f b) -> f (Self b) #

Foldable1 Self Source # 
Instance details

Defined in Data.Semigroup.Self

Methods

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

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

toNonEmpty :: Self a -> NonEmpty a #

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 #

Semigroup m => Semigroup (Self m) Source # 
Instance details

Defined in Data.Semigroup.Self

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) Source # 
Instance details

Defined in Data.Semigroup.Self

Methods

mempty :: Self m #

mappend :: Self m -> Self m -> Self m #

mconcat :: [Self m] -> Self m #