Safe Haskell | None |
---|---|

Language | Haskell2010 |

This module defines an API centred around linked lists of unlifted values.

## Synopsis

- data UList (a :: TYPE UnliftedRep) where
- map :: (a -> b) -> UList a -> UList b
- foldr :: (a -> b -> b) -> b -> UList a -> b
- foldl :: forall a b. (b -> a -> b) -> b -> UList a -> b
- foldl' :: forall a b. (b -> a -> b) -> b -> UList a -> b
- null :: UList a -> Bool
- scanl :: (b -> a -> b) -> b -> UList a -> UList b
- filter :: (a -> Bool) -> UList a -> UList a
- length :: UList a -> Int
- (.) :: forall (a :: TYPE UnliftedRep) (b :: TYPE UnliftedRep) (c :: TYPE UnliftedRep). (b -> c) -> (a -> b) -> a -> c

# Documentation

data UList (a :: TYPE UnliftedRep) where Source #

A linked list of unlifted values. The values stored in the list are guaranteed to not be thunks.

map :: (a -> b) -> UList a -> UList b Source #

`map`

`f xs`

is the list obtained by applying `f`

to each element
of `xs`

, i.e.,

map f [x1, x2, ..., xn] == [f x1, f x2, ..., f xn] map f [x1, x2, ...] == [f x1, f x2, ...]

foldr :: (a -> b -> b) -> b -> UList a -> b Source #

`foldr`

, applied to a binary operator, a starting value (typically
the right-identity of the operator), and a list, reduces the list
using the binary operator, from right to left:

foldr f z [x1, x2, ..., xn] == x1 `f` (x2 `f` ... (xn `f` z)...)

foldl :: forall a b. (b -> a -> b) -> b -> UList a -> b Source #

`foldl`

, applied to a binary operator, a starting value (typically
the left-identity of the operator), and a list, reduces the list
using the binary operator, from left to right:

foldl f z [x1, x2, ..., xn] == (...((z `f` x1) `f` x2) `f`...) `f` xn

The list must be finite.

filter :: (a -> Bool) -> UList a -> UList a Source #

`filter`

, applied to a predicate and a list, returns the list of
those elements that satisfy the predicate; i.e.,

filter p xs = [ x | x <- xs, p x]

(.) :: forall (a :: TYPE UnliftedRep) (b :: TYPE UnliftedRep) (c :: TYPE UnliftedRep). (b -> c) -> (a -> b) -> a -> c Source #

Function composition.