data-diverse-0.2.1.0: Extensible records and polymorphic variants.

Safe HaskellSafe
LanguageHaskell2010

Data.Diverse.Collector

Synopsis

Documentation

newtype Collector e xs r Source #

Folds output from an Emitter of values while reiterateing the xs typelist. This guarantees that the Emit e '[] is not instantiated. Undecidable instances! But this is safe since it's a wrapper

Constructors

Collector (e xs r) 

Instances

(Emit Type e ((:) Type x xs) r, Reiterate * e ((:) Type x xs), AFoldable (Collector * e xs) r) => AFoldable (Collector * e ((:) Type x xs)) r Source #

Folds values by reiterateing Emitters through the xs typelist.

Methods

afoldr :: (r -> b -> b) -> b -> Collector * e ((Type ': x) xs) r -> b Source #

AFoldable (Collector * e ([] Type)) r Source #

null case that doesn't even use emit, so that an instance of Emit e '[] is not needed.

Methods

afoldr :: (r -> b -> b) -> b -> Collector * e [Type] r -> b Source #

newtype Collector0 e xs r Source #

A variation of Collector which does require the Emit e '[] instance for the empty typelist. Undecidable instances! But this is safe since it's a wrapper

Constructors

Collector0 (e xs r) 

Instances

(Emit Type e ((:) Type x xs) r, Reiterate * e ((:) Type x xs), AFoldable (Collector0 * e xs) r) => AFoldable (Collector0 * e ((:) Type x xs)) r Source #

Folds values by reiterateing Emitters through the xs typelist.

Methods

afoldr :: (r -> b -> b) -> b -> Collector0 * e ((Type ': x) xs) r -> b Source #

Emit Type e ([] Type) r => AFoldable (Collector0 * e ([] Type)) r Source #

terminating case that does use Emit e '[]

Methods

afoldr :: (r -> b -> b) -> b -> Collector0 * e [Type] r -> b Source #

newtype CollectorN e n xs r Source #

A variation of Collector which reiterateNs the xs typelist. This version guarantees that the Emit (e n) '[] is not instantiated. Undecidable instances! But this is safe since it's a wrapper

Constructors

CollectorN (e n xs r) 

Instances

(Emit Type (e n) ((:) Type x xs) r, ReiterateN * e n ((:) Type x xs), AFoldable (CollectorN * e ((+) n 1) xs) r) => AFoldable (CollectorN * e n ((:) Type x xs)) r Source #

Folds values by reiterateNing Emitters through the xs typelist.

Methods

afoldr :: (r -> b -> b) -> b -> CollectorN * e n ((Type ': x) xs) r -> b Source #

AFoldable (CollectorN * e n ([] Type)) r Source #

null case that doesn't even use emit, so that an instance of Emit (e n) '[] is not needed.

Methods

afoldr :: (r -> b -> b) -> b -> CollectorN * e n [Type] r -> b Source #

newtype CollectorN0 e n xs r Source #

A variation of Collector0 which reiterateNs the xs typelist. Undecidable instances! But this is safe since it's a wrapper

Constructors

CollectorN0 (e n xs r) 

Instances

(Emit Type (e n) ((:) Type x xs) r, ReiterateN * e n ((:) Type x xs), AFoldable (CollectorN0 * e ((+) n 1) xs) r) => AFoldable (CollectorN0 * e n ((:) Type x xs)) r Source #

Folds values by reiterateNing Emitters through the xs typelist.

Methods

afoldr :: (r -> b -> b) -> b -> CollectorN0 * e n ((Type ': x) xs) r -> b Source #

Emit Type (e n) ([] Type) r => AFoldable (CollectorN0 * e n ([] Type)) r Source #

terminating case that does use Emit (e n) '[]

Methods

afoldr :: (r -> b -> b) -> b -> CollectorN0 * e n [Type] r -> b Source #