| Copyright | (c) Artem Chirkin |
|---|---|
| License | BSD3 |
| Maintainer | chirkin@arch.ethz.ch |
| Safe Haskell | None |
| Language | Haskell2010 |
Numeric.Semigroup.StrictTuple
Description
This module defines a set of tuple data types to substitute normal lazy tuples.
The reason is that Monoid instances of normal tuples are lazy,
which makes folds with arithmetic operations leak memory.
Semigroup and Monoid instances of these tuples are strict in all their arguments.
Using tuple types defined here together with Numeric.Semigroup.foldMap',
one can combine multiple monoidal fold structures in a single pass over foldable container:
> foldMap' (T3 <$> Max <*> Sum <*> minMax) $ take 100000000 ([1..] :: [Int])
The example above runs in constant space, which would not happen with normal
GHC tuples due to strictness properties of their mappend implementations
(tuple arguments are not enforced).
Documentation
Constructors
| T0 |
Constructors
| T1 a |
Instances
| Monad T1 Source # | |
| Functor T1 Source # | |
| Applicative T1 Source # | |
| Foldable T1 Source # | |
| Traversable T1 Source # | |
| Generic1 T1 Source # | |
| Bounded a => Bounded (T1 a) Source # | |
| Eq a => Eq (T1 a) Source # | |
| Data a => Data (T1 a) Source # | |
| Ord a => Ord (T1 a) Source # | |
| Read a => Read (T1 a) Source # | |
| Show a => Show (T1 a) Source # | |
| Generic (T1 a) Source # | |
| Semigroup a => Semigroup (T1 a) Source # | |
| Monoid a => Monoid (T1 a) Source # | |
| type Rep1 T1 Source # | |
| type Rep (T1 a) Source # | |
Constructors
| T2 a b |
Instances
| Bifunctor T2 Source # | |
| Monoid a => Monad (T2 a) Source # | |
| Functor (T2 a) Source # | |
| Monoid a => Applicative (T2 a) Source # | |
| Foldable (T2 a) Source # | |
| Traversable (T2 a) Source # | |
| Generic1 (T2 a) Source # | |
| (Bounded a, Bounded b) => Bounded (T2 a b) Source # | |
| (Eq b, Eq a) => Eq (T2 a b) Source # | |
| (Data b, Data a) => Data (T2 a b) Source # | |
| (Ord b, Ord a) => Ord (T2 a b) Source # | |
| (Read b, Read a) => Read (T2 a b) Source # | |
| (Show b, Show a) => Show (T2 a b) Source # | |
| Generic (T2 a b) Source # | |
| (Semigroup a, Semigroup b) => Semigroup (T2 a b) Source # | |
| (Monoid a, Monoid b) => Monoid (T2 a b) Source # | |
| StrictTuple (a, b) (T2 a b) Source # | |
| type Rep1 (T2 a) Source # | |
| type Rep (T2 a b) Source # | |
Constructors
| T3 a b c |
Instances
| Bifunctor (T3 a) Source # | |
| (Monoid a, Monoid b) => Monad (T3 a b) Source # | |
| Functor (T3 a b) Source # | |
| (Monoid a, Monoid b) => Applicative (T3 a b) Source # | |
| Foldable (T3 a b) Source # | |
| Traversable (T3 a b) Source # | |
| Generic1 (T3 a b) Source # | |
| (Bounded a, Bounded b, Bounded c) => Bounded (T3 a b c) Source # | |
| (Eq c, Eq b, Eq a) => Eq (T3 a b c) Source # | |
| (Data c, Data b, Data a) => Data (T3 a b c) Source # | |
| (Ord c, Ord b, Ord a) => Ord (T3 a b c) Source # | |
| (Read c, Read b, Read a) => Read (T3 a b c) Source # | |
| (Show c, Show b, Show a) => Show (T3 a b c) Source # | |
| Generic (T3 a b c) Source # | |
| (Semigroup a, Semigroup b, Semigroup c) => Semigroup (T3 a b c) Source # | |
| (Monoid a, Monoid b, Monoid c) => Monoid (T3 a b c) Source # | |
| StrictTuple (a, b, c) (T3 a b c) Source # | |
| type Rep1 (T3 a b) Source # | |
| type Rep (T3 a b c) Source # | |
Constructors
| T4 a b c d |
Instances
| Bifunctor (T4 a b) Source # | |
| (Monoid a, Monoid b, Monoid c) => Monad (T4 a b c) Source # | |
| Functor (T4 a b c) Source # | |
| (Monoid a, Monoid b, Monoid c) => Applicative (T4 a b c) Source # | |
| Foldable (T4 a b c) Source # | |
| Traversable (T4 a b c) Source # | |
| Generic1 (T4 a b c) Source # | |
| (Bounded a, Bounded b, Bounded c, Bounded d) => Bounded (T4 a b c d) Source # | |
| (Eq d, Eq c, Eq b, Eq a) => Eq (T4 a b c d) Source # | |
| (Data d, Data c, Data b, Data a) => Data (T4 a b c d) Source # | |
| (Ord d, Ord c, Ord b, Ord a) => Ord (T4 a b c d) Source # | |
| (Read d, Read c, Read b, Read a) => Read (T4 a b c d) Source # | |
| (Show d, Show c, Show b, Show a) => Show (T4 a b c d) Source # | |
| Generic (T4 a b c d) Source # | |
| (Semigroup a, Semigroup b, Semigroup c, Semigroup d) => Semigroup (T4 a b c d) Source # | |
| (Monoid a, Monoid b, Monoid c, Monoid d) => Monoid (T4 a b c d) Source # | |
| StrictTuple (a, b, c, d) (T4 a b c d) Source # | |
| type Rep1 (T4 a b c) Source # | |
| type Rep (T4 a b c d) Source # | |
Constructors
| T5 a b c d e |
Instances
| Bifunctor (T5 a b c) Source # | |
| (Monoid a, Monoid b, Monoid c, Monoid d) => Monad (T5 a b c d) Source # | |
| Functor (T5 a b c d) Source # | |
| (Monoid a, Monoid b, Monoid c, Monoid d) => Applicative (T5 a b c d) Source # | |
| Foldable (T5 a b c e) Source # | |
| Traversable (T5 a b c d) Source # | |
| Generic1 (T5 a b c d) Source # | |
| (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e) => Bounded (T5 a b c d e) Source # | |
| (Eq e, Eq d, Eq c, Eq b, Eq a) => Eq (T5 a b c d e) Source # | |
| (Data e, Data d, Data c, Data b, Data a) => Data (T5 a b c d e) Source # | |
| (Ord e, Ord d, Ord c, Ord b, Ord a) => Ord (T5 a b c d e) Source # | |
| (Read e, Read d, Read c, Read b, Read a) => Read (T5 a b c d e) Source # | |
| (Show e, Show d, Show c, Show b, Show a) => Show (T5 a b c d e) Source # | |
| Generic (T5 a b c d e) Source # | |
| (Semigroup a, Semigroup b, Semigroup c, Semigroup d, Semigroup e) => Semigroup (T5 a b c d e) Source # | |
| (Monoid a, Monoid b, Monoid c, Monoid d, Monoid e) => Monoid (T5 a b c d e) Source # | |
| StrictTuple (a, b, c, d, e) (T5 a b c d e) Source # | |
| type Rep1 (T5 a b c d) Source # | |
| type Rep (T5 a b c d e) Source # | |
Constructors
| T6 a b c d e f |
Instances
| Bifunctor (T6 a b c d) Source # | |
| (Monoid a, Monoid b, Monoid c, Monoid d, Monoid e) => Monad (T6 a b c d e) Source # | |
| Functor (T6 a b c d e) Source # | |
| (Monoid a, Monoid b, Monoid c, Monoid d, Monoid e) => Applicative (T6 a b c d e) Source # | |
| Foldable (T6 a b c d e) Source # | |
| Traversable (T6 a b c d e) Source # | |
| Generic1 (T6 a b c d e) Source # | |
| (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f) => Bounded (T6 a b c d e f) Source # | |
| (Eq f, Eq e, Eq d, Eq c, Eq b, Eq a) => Eq (T6 a b c d e f) Source # | |
| (Data f, Data e, Data d, Data c, Data b, Data a) => Data (T6 a b c d e f) Source # | |
| (Ord f, Ord e, Ord d, Ord c, Ord b, Ord a) => Ord (T6 a b c d e f) Source # | |
| (Read f, Read e, Read d, Read c, Read b, Read a) => Read (T6 a b c d e f) Source # | |
| (Show f, Show e, Show d, Show c, Show b, Show a) => Show (T6 a b c d e f) Source # | |
| Generic (T6 a b c d e f) Source # | |
| (Semigroup a, Semigroup b, Semigroup c, Semigroup d, Semigroup e, Semigroup f) => Semigroup (T6 a b c d e f) Source # | |
| (Monoid a, Monoid b, Monoid c, Monoid d, Monoid e, Monoid f) => Monoid (T6 a b c d e f) Source # | |
| StrictTuple (a, b, c, d, e, f) (T6 a b c d e f) Source # | |
| type Rep1 (T6 a b c d e) Source # | |
| type Rep (T6 a b c d e f) Source # | |
data T7 a b c d e f g Source #
Constructors
| T7 a b c d e f g |
Instances
| Bifunctor (T7 a b c d e) Source # | |
| (Monoid a, Monoid b, Monoid c, Monoid d, Monoid e, Monoid f) => Monad (T7 a b c d e f) Source # | |
| Functor (T7 a b c d e f) Source # | |
| (Monoid a, Monoid b, Monoid c, Monoid d, Monoid e, Monoid f) => Applicative (T7 a b c d e f) Source # | |
| Foldable (T7 a b c d e f) Source # | |
| Traversable (T7 a b c d e f) Source # | |
| Generic1 (T7 a b c d e f) Source # | |
| (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g) => Bounded (T7 a b c d e f g) Source # | |
| (Eq g, Eq f, Eq e, Eq d, Eq c, Eq b, Eq a) => Eq (T7 a b c d e f g) Source # | |
| (Data g, Data f, Data e, Data d, Data c, Data b, Data a) => Data (T7 a b c d e f g) Source # | |
| (Ord g, Ord f, Ord e, Ord d, Ord c, Ord b, Ord a) => Ord (T7 a b c d e f g) Source # | |
| (Read g, Read f, Read e, Read d, Read c, Read b, Read a) => Read (T7 a b c d e f g) Source # | |
| (Show g, Show f, Show e, Show d, Show c, Show b, Show a) => Show (T7 a b c d e f g) Source # | |
| Generic (T7 a b c d e f g) Source # | |
| (Semigroup a, Semigroup b, Semigroup c, Semigroup d, Semigroup e, Semigroup f, Semigroup g) => Semigroup (T7 a b c d e f g) Source # | |
| (Monoid a, Monoid b, Monoid c, Monoid d, Monoid e, Monoid f, Monoid g) => Monoid (T7 a b c d e f g) Source # | |
| StrictTuple (a, b, c, d, e, f, g) (T7 a b c d e f g) Source # | |
| type Rep1 (T7 a b c d e f) Source # | |
| type Rep (T7 a b c d e f g) Source # | |
data T8 a b c d e f g h Source #
Constructors
| T8 a b c d e f g h |
Instances
| Bifunctor (T8 a b c d e f) Source # | |
| (Monoid a, Monoid b, Monoid c, Monoid d, Monoid e, Monoid f, Monoid g) => Monad (T8 a b c d e f g) Source # | |
| Functor (T8 a b c d e f g) Source # | |
| (Monoid a, Monoid b, Monoid c, Monoid d, Monoid e, Monoid f, Monoid g) => Applicative (T8 a b c d e f g) Source # | |
| Foldable (T8 a b c d e f g) Source # | |
| Traversable (T8 a b c d e f g) Source # | |
| Generic1 (T8 a b c d e f g) Source # | |
| (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h) => Bounded (T8 a b c d e f g h) Source # | |
| (Eq h, Eq g, Eq f, Eq e, Eq d, Eq c, Eq b, Eq a) => Eq (T8 a b c d e f g h) Source # | |
| (Data h, Data g, Data f, Data e, Data d, Data c, Data b, Data a) => Data (T8 a b c d e f g h) Source # | |
| (Ord h, Ord g, Ord f, Ord e, Ord d, Ord c, Ord b, Ord a) => Ord (T8 a b c d e f g h) Source # | |
| (Read h, Read g, Read f, Read e, Read d, Read c, Read b, Read a) => Read (T8 a b c d e f g h) Source # | |
| (Show h, Show g, Show f, Show e, Show d, Show c, Show b, Show a) => Show (T8 a b c d e f g h) Source # | |
| Generic (T8 a b c d e f g h) Source # | |
| (Semigroup a, Semigroup b, Semigroup c, Semigroup d, Semigroup e, Semigroup f, Semigroup g, Semigroup h) => Semigroup (T8 a b c d e f g h) Source # | |
| (Monoid a, Monoid b, Monoid c, Monoid d, Monoid e, Monoid f, Monoid g, Monoid h) => Monoid (T8 a b c d e f g h) Source # | |
| StrictTuple (a, b, c, d, e, f, g, h) (T8 a b c d e f g h) Source # | |
| type Rep1 (T8 a b c d e f g) Source # | |
| type Rep (T8 a b c d e f g h) Source # | |
data T9 a b c d e f g h i Source #
Constructors
| T9 a b c d e f g h i |
Instances
| Bifunctor (T9 a b c d e f g) Source # | |
| (Monoid a, Monoid b, Monoid c, Monoid d, Monoid e, Monoid f, Monoid g, Monoid h) => Monad (T9 a b c d e f g h) Source # | |
| Functor (T9 a b c d e f g h) Source # | |
| (Monoid a, Monoid b, Monoid c, Monoid d, Monoid e, Monoid f, Monoid g, Monoid h) => Applicative (T9 a b c d e f g h) Source # | |
| Foldable (T9 a b c d e f g h) Source # | |
| Traversable (T9 a b c d e f g h) Source # | |
| Generic1 (T9 a b c d e f g h) Source # | |
| (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i) => Bounded (T9 a b c d e f g h i) Source # | |
| (Eq i, Eq h, Eq g, Eq f, Eq e, Eq d, Eq c, Eq b, Eq a) => Eq (T9 a b c d e f g h i) Source # | |
| (Data i, Data h, Data g, Data f, Data e, Data d, Data c, Data b, Data a) => Data (T9 a b c d e f g h i) Source # | |
| (Ord i, Ord h, Ord g, Ord f, Ord e, Ord d, Ord c, Ord b, Ord a) => Ord (T9 a b c d e f g h i) Source # | |
| (Read i, Read h, Read g, Read f, Read e, Read d, Read c, Read b, Read a) => Read (T9 a b c d e f g h i) Source # | |
| (Show i, Show h, Show g, Show f, Show e, Show d, Show c, Show b, Show a) => Show (T9 a b c d e f g h i) Source # | |
| Generic (T9 a b c d e f g h i) Source # | |
| (Semigroup a, Semigroup b, Semigroup c, Semigroup d, Semigroup e, Semigroup f, Semigroup g, Semigroup h, Semigroup i) => Semigroup (T9 a b c d e f g h i) Source # | |
| (Monoid a, Monoid b, Monoid c, Monoid d, Monoid e, Monoid f, Monoid g, Monoid h, Monoid i) => Monoid (T9 a b c d e f g h i) Source # | |
| StrictTuple (a, b, c, d, e, f, g, h, i) (T9 a b c d e f g h i) Source # | |
| type Rep1 (T9 a b c d e f g h) Source # | |
| type Rep (T9 a b c d e f g h i) Source # | |
class StrictTuple a b | a -> b, b -> a where Source #
Minimal complete definition
Instances
| StrictTuple () T0 Source # | |
| StrictTuple (a, b) (T2 a b) Source # | |
| StrictTuple (a, b, c) (T3 a b c) Source # | |
| StrictTuple (a, b, c, d) (T4 a b c d) Source # | |
| StrictTuple (a, b, c, d, e) (T5 a b c d e) Source # | |
| StrictTuple (a, b, c, d, e, f) (T6 a b c d e f) Source # | |
| StrictTuple (a, b, c, d, e, f, g) (T7 a b c d e f g) Source # | |
| StrictTuple (a, b, c, d, e, f, g, h) (T8 a b c d e f g h) Source # | |
| StrictTuple (a, b, c, d, e, f, g, h, i) (T9 a b c d e f g h i) Source # | |