Copyright | (C) 2017 Alexey Vagarenko |
---|---|

License | BSD-style (see LICENSE) |

Maintainer | Alexey Vagarenko (vagarenko@gmail.com) |

Stability | experimental |

Portability | non-portable |

Safe Haskell | None |

Language | Haskell2010 |

This module provides unrollable versions of functions on lists.

Classes in this module are assumed to be closed. You **should not** create
new instances for them.

- class Append (n :: Nat) where
- class Drop (n :: Nat) where
- class Take (n :: Nat) where
- splitAt :: forall (n :: Nat) a. (Take n, Drop n) => [a] -> ([a], [a])
- class ChunksOf (n :: Nat) (c :: Nat) where
- type family ChunksCount (len :: Nat) (clen :: Nat) where ...
- class Zip (n :: Nat) where
- class Zip3 (n :: Nat) where
- class ZipWith (n :: Nat) where
- class Unzip (n :: Nat) where
- class Filter (n :: Nat) where
- class Map (n :: Nat) where
- class All (n :: Nat) where
- class Foldr (n :: Nat) where
- class Foldr1 (n :: Nat) where
- class Foldl (n :: Nat) where
- class Foldl1 (n :: Nat) where
- foldMap :: forall (n :: Nat) m a. FoldMap n m => (a -> m) -> [a] -> m
- type FoldMap (n :: Nat) m = (Monoid m, Foldr n)
- sum :: forall (n :: Nat) a. Sum n a => [a] -> a
- type Sum (n :: Nat) a = (Foldr n, Num a)
- class Replicate (n :: Nat) where
- class EnumFromN (n :: Nat) where
- class EnumFromStepN (n :: Nat) where

# Documentation

class Append (n :: Nat) where Source #

Append two lists. Type param `l`

is the length of the left list.

splitAt :: forall (n :: Nat) a. (Take n, Drop n) => [a] -> ([a], [a]) Source #

Split list at `n`

-th element.

class ChunksOf (n :: Nat) (c :: Nat) where Source #

Split list into chunks of the given length `c`

. `n`

is length of the list.

type family ChunksCount (len :: Nat) (clen :: Nat) where ... Source #

Number of resulting chunks when list of length `len`

split by chunks of length `clen`

.

ChunksCount 0 _ = 0 | |

ChunksCount _ 0 = 0 | |

ChunksCount l c = If (l <=? c) 1 (1 + ChunksCount (l - c) c) |

class Zip (n :: Nat) where Source #

Zip 2 lists together. Type param `n`

is the length of the first list.

class Zip3 (n :: Nat) where Source #

Zip 3 lists together. Type param `n`

is the length of the first list.

class ZipWith (n :: Nat) where Source #

Zip 2 lists together using given function. Type param `n`

is the length of the first list.

class Filter (n :: Nat) where Source #

Filter list with given predicate. Type param `n`

is the length of the list.

class Map (n :: Nat) where Source #

Apply function to all elements of a list. Type param `n`

is the length of the list.

class All (n :: Nat) where Source #

Check if all elements of the list satisfy the predicate. Type param `n`

is the length of the list.

foldMap :: forall (n :: Nat) m a. FoldMap n m => (a -> m) -> [a] -> m Source #

Map each element of the list of length `n`

to a monoid, and combine the results.

sum :: forall (n :: Nat) a. Sum n a => [a] -> a Source #

Sum of the elements of the list of length `n`

.

class EnumFromStepN (n :: Nat) where Source #

Enumeration of length `n`

starting from given value with given step.

:: Num a | |

=> a | Starting value. |

-> a | Step. |

-> [a] |

EnumFromStepN ((-) n 1) => EnumFromStepN n Source # | |

EnumFromStepN 0 Source # | |