ZVON > References > Haskell reference
| Indexes | Syntax | Prelude | Ratio | Complex | Numeric | Ix | Array | List | >> Maybe << | Char | Monad | IO | Directory | System | Time | Locale | CPUTime | Random

Module: Maybe
Function: listToMaybe
Type: [a] -> Maybe a
Description: If the argument is an empty list, it returns Nothing, othervise it returns Just with the value of the first list item.
Related: maybeToList

Example 1

Input: listToMaybe [1,2,3,4]

Output: Just 1

Example 2

Input: listToMaybe ""

Output: Nothing