| 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 |
Data.List.Unrolled
Description
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.
Minimal complete definition
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.
Minimal complete definition
type family ChunksCount (len :: Nat) (clen :: Nat) where ... Source #
Number of resulting chunks when list of length len split by chunks of length clen.
Equations
| 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.
Minimal complete definition
class Zip3 (n :: Nat) where Source #
Zip 3 lists together. Type param n is the length of the first list.
Minimal complete definition
class ZipWith (n :: Nat) where Source #
Zip 2 lists together using given function. Type param n is the length of the first list.
Minimal complete definition
class Unzip (n :: Nat) where Source #
Unzip a list. Type param n is the length of the list.
Minimal complete definition
class Filter (n :: Nat) where Source #
Filter list with given predicate. Type param n is the length of the list.
Minimal complete definition
class Map (n :: Nat) where Source #
Apply function to all elements of a list. Type param n is the length of the list.
Minimal complete definition
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.
Minimal complete definition
class Foldr1 (n :: Nat) where Source #
Right fold of a list of length n with no base element.
Minimal complete definition
class Foldl1 (n :: Nat) where Source #
Right fold of a list of length n with no base element.
Minimal complete definition
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 Replicate (n :: Nat) where Source #
Fill the list of length n with the same values.
Minimal complete definition
class EnumFromN (n :: Nat) where Source #
Enumeration of length n starting from given value.
Minimal complete definition
class EnumFromStepN (n :: Nat) where Source #
Enumeration of length n starting from given value with given step.
Minimal complete definition
Instances
| EnumFromStepN ((-) n 1) => EnumFromStepN n Source # | |
| EnumFromStepN 0 Source # | |