Hoogle Search
Within LTS Haskell 24.66 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
-
base Data.Maybe The listToMaybe function returns Nothing on an empty list or Just a where a is the first element of the list.
Examples
Basic usage:>>> listToMaybe [] Nothing
>>> listToMaybe [9] Just 9
>>> listToMaybe [1,2,3] Just 1
Composing maybeToList with listToMaybe should be the identity on singleton/empty lists:>>> maybeToList $ listToMaybe [5] [5] >>> maybeToList $ listToMaybe [] []
But not on lists with more than one element:>>> maybeToList $ listToMaybe [1,2,3] [1]
listToMaybeLast :: [a] -> Maybe atest-framework Test.Framework.Providers.API No documentation available.
-
safe Safe No documentation available.
-
safe Safe No documentation available.
-
Cabal Distribution.Simple.Utils A total variant of head.
-
Cabal Distribution.Simple.Utils A total variant of last.
-
ghc GHC.Utils.Misc No documentation available.
-
strict Data.Strict.Maybe Analogous to listToMaybe in Data.Maybe.
-
rio RIO.List No documentation available.
-
rio RIO.List No documentation available.
Page 1 of many | Next