Copyright | (c) Edward Kmett 2009-2016 |
---|---|
License | BSD-style |
Maintainer | ekmett@gmail.com |
Stability | experimental |
Portability | portable |
Safe Haskell | Safe |
Language | Haskell98 |
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.
- class Generator c where
- type Elem c
- 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, Monoid m) => c -> m
- mapReduceWith :: (Generator c, Reducer e m, Monoid m) => (m -> n) -> (Elem c -> e) -> c -> n
- reduceWith :: (Generator c, Reducer (Elem c) m, Monoid m) => (m -> n) -> c -> n
Generators
class Generator c where Source #
mapReduce :: (Reducer e m, Monoid m) => (Elem c -> e) -> c -> m Source #
mapTo :: (Reducer e m, Monoid m) => (Elem c -> e) -> m -> c -> m Source #
mapFrom :: (Reducer e m, Monoid m) => (Elem c -> e) -> c -> m -> m Source #
Generator ByteString Source # | |
Generator ByteString Source # | |
Generator IntSet Source # | |
Generator Text Source # | |
Generator [c] Source # | |
Generator (NonEmpty c) Source # | |
Generator (IntMap v) Source # | |
Generator (Seq c) Source # | |
Generator (Set a) Source # | |
Generator (HashSet a) Source # | |
Generator (Char8 ByteString) Source # | |
Generator (Char8 ByteString) Source # | |
Generator (Values (Array i e)) Source # | |
Generator (Values (IntMap v)) Source # | |
Generator (Values (Map k v)) Source # | |
Ix i => Generator (Keys (Array i e)) Source # | |
Generator (Keys (IntMap v)) Source # | |
Generator (Keys (Map k v)) Source # | |
Ix i => Generator (Array i e) Source # | |
Generator (Map k v) Source # | |
Generator (FingerTree v e) Source # | |
Generator (HashMap k v) Source # | |
Generator Transformers
a Generator
transformer that asks only for the keys of an indexed container
a Generator
transformer that asks only for the values contained in an indexed container
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
Generator (Char8 ByteString) Source # | |
Generator (Char8 ByteString) Source # | |
type Elem (Char8 ByteString) Source # | |
type Elem (Char8 ByteString) Source # | |