Hoogle Search
Within LTS Haskell 24.3 (ghc-9.10.2)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
last :: HasCallStack => [a] -> ahedgehog Hedgehog.Internal.Prelude 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
-
base-compat Data.List.NonEmpty.Compat Extract the last element of the stream.
last :: HasCallStack => [a] -> aghc GHC.Prelude.Basic No documentation available.
last :: Monad m => Producer a m () -> m (Maybe a)pipes Pipes.Prelude Retrieve the last element from a Producer
-
foldl Control.Foldl Get the last element of a container or return Nothing if the container is empty
last :: Fold ByteString (Maybe Word8)foldl Control.Foldl.ByteString Get the last byte of a byte stream or return Nothing if the byte stream is empty
-
foldl Control.Foldl.NonEmpty Get the last element of a non-empty container
last :: Fold Text (Maybe Char)foldl Control.Foldl.Text Get the last character of a text stream or return Nothing if the text stream is empty
-
text-short Data.Text.Short.Partial Return last character from non-empty ShortText.
>>> last "abcd" 'd'
Note: Will throw an error exception for empty ShortTexts. Consider using the total functions unsnoc or indexEndMaybe instead. last :: forall (f :: Type -> Type) a . Foldable f => T f a -> anon-empty Data.NonEmpty No documentation available.