monoids-0.1.30: Monoids, specialized containers and a general map/reduce frameworkSource codeContentsIndex
Data.Generator
Portabilityportable
Stabilityexperimental
Maintainerekmett@gmail.com
Contents
Generators
Generator Transformers
Combinators
Description

A Generator c is a possibly-specialized container, which contains values of type Elem c, and which knows how to efficiently apply a Reducer to extract an answer.

Since a Generator is not polymorphic in its contents, it is more specialized than Data.Foldable.Foldable, and a Reducer may supply efficient left-to-right and right-to-left reduction strategies that a Generator may avail itself of.

Synopsis
module Data.Monoid.Reducer
class Generator c where
type Elem c :: *
mapReduce :: Reducer e m => (Elem c -> e) -> c -> m
mapTo :: Reducer e m => (Elem c -> e) -> m -> c -> m
mapFrom :: Reducer e m => (Elem c -> e) -> c -> m -> m
newtype Keys c = Keys {
getKeys :: c
}
newtype Values c = Values {
getValues :: c
}
newtype Char8 c = Char8 {
getChar8 :: c
}
reduce :: (Generator c, Reducer (Elem c) m) => c -> m
mapReduceWith :: (Generator c, Reducer e m) => (m -> n) -> (Elem c -> e) -> c -> n
reduceWith :: (Generator c, Reducer (Elem c) m) => (m -> n) -> c -> n
Documentation
module Data.Monoid.Reducer
Generators
class Generator c whereSource
minimal definition mapReduce or mapTo
Associated Types
type Elem c :: *Source
Methods
mapReduce :: Reducer e m => (Elem c -> e) -> c -> mSource
mapTo :: Reducer e m => (Elem c -> e) -> m -> c -> mSource
mapFrom :: Reducer e m => (Elem c -> e) -> c -> m -> mSource
show/hide Instances
Generator Transformers
newtype Keys c Source
a Generator transformer that asks only for the keys of an indexed container
Constructors
Keys
getKeys :: c
show/hide Instances
newtype Values c Source
a Generator transformer that asks only for the values contained in an indexed container
Constructors
Values
getValues :: c
show/hide Instances
newtype Char8 c Source
a Generator transformer that treats Word8 as Char This lets you use a ByteString as a Char source without going through a Monoid transformer like UTF8
Constructors
Char8
getChar8 :: c
show/hide Instances
Combinators
reduce :: (Generator c, Reducer (Elem c) m) => c -> mSource
Apply a Reducer directly to the elements of a Generator
mapReduceWith :: (Generator c, Reducer e m) => (m -> n) -> (Elem c -> e) -> c -> nSource
reduceWith :: (Generator c, Reducer (Elem c) m) => (m -> n) -> c -> nSource
Produced by Haddock version 2.4.2