polyvariadic-0.3.0.4: Creation and application of polyvariadic functions

Copyright(c) Francesco Gazzetta 2017
LicenseBSD3 (see the file LICENSE)
Maintainerfrancygazz@gmail.org
Stabilitystable
Portabilityportable
Safe HaskellSafe
LanguageHaskell2010

Data.Accumulator

Description

Accumulators, primarily useful for Polyvariadic

Synopsis

Documentation

class Accumulator acc x where Source #

An 'Accumulator c i' supports accumulation of elements of type i in it. This is different from Semigroup or Monoid, where <> acts between two values with the same type.

Methods

accumulate Source #

Arguments

:: x 
-> acc 
-> acc

Accumulate a value

Instances
Accumulator [a] a Source # 
Instance details

Defined in Data.Accumulator

Methods

accumulate :: a -> [a] -> [a] Source #

Ord a => Accumulator (Set a) a Source # 
Instance details

Defined in Data.Accumulator

Methods

accumulate :: a -> Set a -> Set a Source #

Semigroup m => Accumulator (AccumulatorSemigroup m) (AccumulatorSemigroup m) Source # 
Instance details

Defined in Data.Accumulator

singleton :: (Accumulator acc x, Monoid acc) => x -> acc Source #

Accumulate a single value in a Monoid

accumulateMany :: (Foldable f, Accumulator acc x) => f x -> acc -> acc Source #

Strictly accumulate multiple values from a Foldable, from left to right

newtype AccumulatorSemigroup a Source #

Lift a Semigroup into an Accumulator. This is a newtype because (<>) isn't always the ideal way of accumulating