| Copyright | (c) Galois Inc, 2015 |
|---|---|
| License | Apache-2 |
| Maintainer | jhendrix@galois.com, lcasburn@galois.com |
| Safe Haskell | Trustworthy |
| Language | Haskell98 |
Language.Lean.List
Contents
Description
Declares a data family List for associating a list type
to different Lean values, and provides a typeclass
along with associated operations for constructing and
viewing Lean lists.
- data family List a
- class IsList l => IsListIso l where
- data ListView l a
- fromListDefault :: IsListIso l => [Item l] -> l
- concatList :: IsListIso l => l -> l -> l
- mapList :: (IsListIso s, IsListIso t) => (Item s -> Item t) -> s -> t
- traverseList :: (IsListIso s, IsListIso t) => Traversal s t (Item s) (Item t)
- class IsList l where
Documentation
A type family for mapping a Lean value to the internal list representation.
Instances
class IsList l => IsListIso l where Source
A typeclass for types that are isomorphic to lists.
This is used to provide functions for manipulating Lean's internal lists without the overhead of converting to and from Haskell lists.
fromListDefault :: IsListIso l => [Item l] -> l Source
Convert a ordinary Haskell list to an opague list
concatList :: IsListIso l => l -> l -> l Source
Concatenate two lists
mapList :: (IsListIso s, IsListIso t) => (Item s -> Item t) -> s -> t Source
Apply a function to map one list to another.
traverseList :: (IsListIso s, IsListIso t) => Traversal s t (Item s) (Item t) Source
A traversal of the elements in a list.
Re-exports
class IsList l where
The IsList class and its methods are intended to be used in
conjunction with the OverloadedLists extension.
Since: 4.7.0.0
Associated Types
type Item l :: *
The Item type function returns the type of items of the structure
l.
Methods
The fromList function constructs the structure l from the given
list of Item l
fromListN :: Int -> [Item l] -> l
The fromListN function takes the input list's length as a hint. Its
behaviour should be equivalent to fromList. The hint can be used to
construct the structure l more efficiently compared to fromList. If
the given hint does not equal to the input list's length the behaviour of
fromListN is not specified.
The toList function extracts a list of Item l from the structure l.
It should satisfy fromList . toList = id.
Instances
| IsList Version | Since: 4.8.0.0 |
| IsList IntSet | |
| IsList [a] | |
| IsList (IntMap a) | |
| Ord a => IsList (Set a) | |
| IsList (Seq a) | |
| IsList (Vector a) | |
| Prim a => IsList (Vector a) | |
| Storable a => IsList (Vector a) | |
| (Eq a, Hashable a) => IsList (HashSet a) | |
| IsList (NonEmpty a) | |
| IsList (List Name) | |
| IsList (List Univ) | Allow |
| IsList (List Expr) | |
| IsList (List InductiveType) | |
| Ord k => IsList (Map k v) | |
| (Eq k, Hashable k) => IsList (HashMap k v) |