fromList package:base

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
The fromListN function takes the input list's length and potentially uses it to construct the structure l more efficiently compared to fromList. If the given number does not equal to the input list's length the behaviour of fromListN is not specified.
fromListN (length xs) xs == fromList xs