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

Language | Haskell2010 |

Lists.

## Synopsis

- data Foldr :: (a -> b -> Exp b) -> b -> [a] -> Exp b
- data UnList :: b -> (a -> b -> Exp b) -> [a] -> Exp b
- data Cons :: a -> [a] -> Exp [a]
- data (++) :: [a] -> [a] -> Exp [a]
- data Filter :: (a -> Exp Bool) -> [a] -> Exp [a]
- data Head :: [a] -> Exp (Maybe a)
- data Last :: [a] -> Exp (Maybe a)
- data Tail :: [a] -> Exp (Maybe [a])
- data Init :: [a] -> Exp (Maybe [a])
- data Null :: [a] -> Exp Bool
- data Length :: [a] -> Exp Nat
- data Find :: (a -> Exp Bool) -> [a] -> Exp (Maybe a)
- data FindIndex :: (a -> Exp Bool) -> [a] -> Exp (Maybe Nat)
- type Elem a as = IsJust =<< FindIndex (TyEq a) as
- type Lookup (a :: k) (as :: [(k, b)]) = (Map Snd (Eval (Find (TyEq a <=< Fst) as)) :: Exp (Maybe b))
- data SetIndex :: Nat -> a -> [a] -> Exp [a]
- data ZipWith :: (a -> b -> Exp c) -> [a] -> [b] -> Exp [c]
- type Zip = ZipWith (Pure2 (,))
- data Unzip :: Exp [(a, b)] -> Exp ([a], [b])
- data Cons2 :: (a, b) -> ([a], [b]) -> Exp ([a], [b])

# Documentation

data Foldr :: (a -> b -> Exp b) -> b -> [a] -> Exp b Source #

data UnList :: b -> (a -> b -> Exp b) -> [a] -> Exp b Source #

N.B.: This is equivalent to a `Foldr`

flipped.

data Find :: (a -> Exp Bool) -> [a] -> Exp (Maybe a) Source #

data FindIndex :: (a -> Exp Bool) -> [a] -> Exp (Maybe Nat) Source #

Find the index of an element satisfying the predicate.

type Lookup (a :: k) (as :: [(k, b)]) = (Map Snd (Eval (Find (TyEq a <=< Fst) as)) :: Exp (Maybe b)) Source #

data SetIndex :: Nat -> a -> [a] -> Exp [a] Source #

Modify an element at a given index.

The list is unchanged if the index is out of bounds.

data ZipWith :: (a -> b -> Exp c) -> [a] -> [b] -> Exp [c] Source #