toList

List of elements of a structure, from left to right. If the entire list is intended to be reduced via a fold, just fold the structure directly bypassing the list.

Examples

Basic usage:
>>> toList Nothing
[]
>>> toList (Just 42)
[42]
>>> toList (Left "foo")
[]
>>> toList (Node (Leaf 5) 17 (Node Empty 12 (Leaf 8)))
[5,17,12,8]
For lists, toList is the identity:
>>> toList [1, 2, 3]
[1,2,3]
Convert a stream to a normal list efficiently.
The toList function extracts a list of Item l from the structure l. It should satisfy fromList . toList = id.
Convert an immutable array to a list.
Convert the map to a list of key/value pairs. Subject to list fusion.
toList (fromList [(5,"a"), (3,"b")]) == [(3,"b"), (5,"a")]
toList empty == []
Convert the set to a list of elements. Subject to list fusion.
Convert the map to a list of key/value pairs. Subject to list fusion.
toList (fromList [(5,"a"), (3,"b")]) == [(3,"b"), (5,"a")]
toList empty == []
Convert the set to a list of elements. Subject to list fusion.
Return a list of this map's keys and elements. The order is not stable. Use toAscList for stable ordering.
Return a list of this map's elements. The list is produced lazily. The order of its elements is unspecified.
Return a list of this set's elements. The list is produced lazily.
Convert the map to a list of key/value pairs. Subject to list fusion.
toList (fromList [(5,"a"), (3,"b")]) == [(3,"b"), (5,"a")]
toList empty == []
Convert the set to a list of elements. Subject to list fusion.
Convert a pure Producer into a list
toList xs is the list represented by xs. toList obeys the laws:
toList . fromList = id
fromList . toList = id
Evaluating toList xs may “collapse” the chain of function composition underlying many DList functions (append in particular) used to construct xs. This may affect any efficiency you achieved due to laziness in the construction.
toList xs is the non-empty list represented by xs. toList obeys the law:
toList xs = toList (toNonEmpty xs)