Copyright | (c) Edward Kmett 2009-2016 |
---|---|
License | BSD-style |
Maintainer | ekmett@gmail.com |
Stability | experimental |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
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
- class Generator c where
- 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 #
Nothing
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 #
Instances
Generator Transformers
a Generator
transformer that asks only for the keys of an indexed container
Instances
Ix i => Generator (Keys (Array i e)) Source # | |
Defined in Data.Generator mapReduce :: (Reducer e0 m, Monoid m) => (Elem (Keys (Array i e)) -> e0) -> Keys (Array i e) -> m Source # mapTo :: (Reducer e0 m, Monoid m) => (Elem (Keys (Array i e)) -> e0) -> m -> Keys (Array i e) -> m Source # mapFrom :: (Reducer e0 m, Monoid m) => (Elem (Keys (Array i e)) -> e0) -> Keys (Array i e) -> m -> m Source # | |
Generator (Keys (IntMap v)) Source # | |
Defined in Data.Generator mapReduce :: (Reducer e m, Monoid m) => (Elem (Keys (IntMap v)) -> e) -> Keys (IntMap v) -> m Source # mapTo :: (Reducer e m, Monoid m) => (Elem (Keys (IntMap v)) -> e) -> m -> Keys (IntMap v) -> m Source # mapFrom :: (Reducer e m, Monoid m) => (Elem (Keys (IntMap v)) -> e) -> Keys (IntMap v) -> m -> m Source # | |
Generator (Keys (Map k v)) Source # | |
Defined in Data.Generator mapReduce :: (Reducer e m, Monoid m) => (Elem (Keys (Map k v)) -> e) -> Keys (Map k v) -> m Source # mapTo :: (Reducer e m, Monoid m) => (Elem (Keys (Map k v)) -> e) -> m -> Keys (Map k v) -> m Source # mapFrom :: (Reducer e m, Monoid m) => (Elem (Keys (Map k v)) -> e) -> Keys (Map k v) -> m -> m Source # | |
type Elem (Keys (Array i e)) Source # | |
Defined in Data.Generator | |
type Elem (Keys (IntMap v)) Source # | |
Defined in Data.Generator | |
type Elem (Keys (Map k v)) Source # | |
Defined in Data.Generator |
a Generator
transformer that asks only for the values contained in an indexed container
Instances
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
Instances
Generator (Char8 ByteString) Source # | |
Defined in Data.Generator type Elem (Char8 ByteString) Source # mapReduce :: (Reducer e m, Monoid m) => (Elem (Char8 ByteString) -> e) -> Char8 ByteString -> m Source # mapTo :: (Reducer e m, Monoid m) => (Elem (Char8 ByteString) -> e) -> m -> Char8 ByteString -> m Source # mapFrom :: (Reducer e m, Monoid m) => (Elem (Char8 ByteString) -> e) -> Char8 ByteString -> m -> m Source # | |
Generator (Char8 ByteString) Source # | |
Defined in Data.Generator type Elem (Char8 ByteString) Source # mapReduce :: (Reducer e m, Monoid m) => (Elem (Char8 ByteString) -> e) -> Char8 ByteString -> m Source # mapTo :: (Reducer e m, Monoid m) => (Elem (Char8 ByteString) -> e) -> m -> Char8 ByteString -> m Source # mapFrom :: (Reducer e m, Monoid m) => (Elem (Char8 ByteString) -> e) -> Char8 ByteString -> m -> m Source # | |
type Elem (Char8 ByteString) Source # | |
Defined in Data.Generator | |
type Elem (Char8 ByteString) Source # | |
Defined in Data.Generator |