fromList -package:containers

Converts a normal list to a NonEmpty stream. Raises an error if given an empty list.
The fromList function constructs the structure l from the given list of Item l
Construct a map with the supplied mappings. If the list contains duplicate mappings, the later mappings take precedence.
>>> fromList [("a", 'x'), ("a", 'y')]
fromList [("a",'y')]
O(n) Convert a list to a vector. During the operation, the vector’s capacity will be doubling until the list's contents are in the vector. Depending on the list’s size, up to half of the vector’s capacity might be empty. If you’d rather avoid this, you can use fromListN, which will provide the exact space the list requires but will prevent list fusion, or force . fromList, which will create the vector and then copy it without the superfluous space.
Create a Bundle from a list
Convert a list to a Bundle
O(n) Convert a list to a vector. During the operation, the vector’s capacity will be doubling until the list's contents are in the vector. Depending on the list’s size, up to half of the vector’s capacity might be empty. If you’d rather avoid this, you can use fromListN, which will provide the exact space the list requires but will prevent list fusion, or force . fromList, which will create the vector and then copy it without the superfluous space.
O(n) Convert a list to a vector. During the operation, the vector’s capacity will be doubling until the list's contents are in the vector. Depending on the list’s size, up to half of the vector’s capacity might be empty. If you’d rather avoid this, you can use fromListN, which will provide the exact space the list requires but will prevent list fusion, or force . fromList, which will create the vector and then copy it without the superfluous space.
O(n) Convert a list to a vector. During the operation, the vector’s capacity will be doubling until the list's contents are in the vector. Depending on the list’s size, up to half of the vector’s capacity might be empty. If you’d rather avoid this, you can use fromListN, which will provide the exact space the list requires but will prevent list fusion, or force . fromList, which will create the vector and then copy it without the superfluous space.
O(n) Convert a list to a vector. During the operation, the vector’s capacity will be doubling until the list's contents are in the vector. Depending on the list’s size, up to half of the vector’s capacity might be empty. If you’d rather avoid this, you can use fromListN, which will provide the exact space the list requires but will prevent list fusion, or force . fromList, which will create the vector and then copy it without the superfluous space.
Construct a map with the supplied mappings. If the list contains duplicate mappings, the later mappings take precedence.
Construct a set from a list of elements.
O(n) amortized. Construct a Deque from a list of values.
>>> fromList [1,2]
BD 1 [1] 1 [2]
Build an index out of a bunch of packages. If there are duplicates by UnitId then later ones mask earlier ones.
Store the list in a flattened memory representation, avoiding the memory overhead of a linked list. The size n needs to be smaller or equal to the length of the list. If it is smaller than the length of the list, overflowing elements are discarded. It is undefined behaviour to set n to be bigger than the length of the list.
Turn a list into a Stream, by yielding each element in turn.
Create a map from a list of key/value pairs.
fromList [] == empty
fromList [(5,"a"), (3,"b"), (5, "c")] == fromList [(5,"c"), (3,"b")]
fromList [(5,"c"), (3,"b"), (5, "a")] == fromList [(5,"a"), (3,"b")]
Create a set from a list of integers.
fromList xs is a DList representing the list xs. fromList obeys the laws:
toList . fromList = id
fromList . toList = id
This function is implemented with ++. Repeated uses of fromList are just as inefficient as repeated uses of ++. If you find yourself doing some form of the following (possibly indirectly), you may not be taking advantage of the DList representation and library:
fromList . f . toList
More likely, you will convert from a list, perform some operation on the DList, and convert back to a list:
toList . g . fromList
fromList xs is a DNonEmpty representing the list xs. If xs is empty, an error is raised. fromList obeys the law:
fromList xs = fromNonEmpty (fromList xs)