last
Extract the last element of a list, which must be finite
and non-empty.
>>> last [1, 2, 3]
3
>>> last [1..]
* Hangs forever *
>>> last []
*** Exception: Prelude.last: empty list
WARNING: This function is partial. You can use
reverse with
case-matching,
uncons or
listToMaybe instead.
The last element of a non-empty structure.
>>> last (1 :| [2, 3, 4])
4
Extract the last element of the stream.
O(1) Extract the last element of a ByteString, which must be
finite and non-empty. An exception will be thrown in the case of an
empty ByteString.
This is a partial function, consider using
unsnoc instead.
O(1) Extract the last element of a packed string, which must be
non-empty.
O(n/c) Extract the last element of a ByteString, which must be
finite and non-empty.
This is a partial function, consider using
unsnoc instead.
O(1) Extract the last element of a ShortByteString, which must
be finite and non-empty. An exception will be thrown in the case of an
empty ShortByteString.
This is a partial function, consider using
unsnoc instead.
O(1) Returns the last character of a
Text, which must be
non-empty. This is a partial function, consider using
unsnoc
instead.
O(n/c) Returns the last character of a
Text, which must
be non-empty. This is a partial function, consider using
unsnoc
instead.
O(1) Extract the last element of a ShortByteString, which must
be finite and at least one Word16. An exception will be thrown in the
case of an empty ShortByteString.
Last element of the
Bundle or error if empty
Last element of the
Bundle or error if empty
Retrieve the last value in the stream, if present.
Subject to fusion
Extract the last element of a list, which must be finite
and non-empty.
>>> last [1, 2, 3]
3
>>> last [1..]
* Hangs forever *
>>> last []
*** Exception: Prelude.last: empty list
Retrieve the last element from a
Producer
Get the last element of a container or return
Nothing if the
container is empty
Get the last byte of a byte stream or return
Nothing if the
byte stream is empty
Get the last element of a non-empty container
Get the last character of a text stream or return
Nothing if
the text stream is empty