:: [a] -> a package:ghc-lib-parser
Extract the last element of a list, which must be finite
and non-empty.
WARNING: This function is partial. Consider using
unsnoc
instead.
Examples
>>> last [1, 2, 3]
3
>>> last [1..]
* Hangs forever *
>>> last []
*** Exception: Prelude.last: empty list
Utility function to go from a singleton list to it's element.
Wether or not the argument is a singleton list is only checked in
debug builds.