ZVON > References > Haskell reference |
Intro / Search / ZVON |
| Indexes | Syntax | Prelude | Ratio | Complex | Numeric | Ix | Array | List | >> Maybe << | Char | Monad | IO | Directory | System | Time | Locale | CPUTime | Random |
Module: | Maybe |
---|---|
Function: | maybeToList |
Type: | Maybe a -> [a] |
Description: | If the argument is Just, it returns a list with the Just value as its element, otherwise it returns empty list |
Related: | fromJust, fromMaybe, listToMaybe, mapMaybe |
Input: maybeToList (lookup 3 [(1,'A'),(2,'B'),(3,'C')])
Output: "C"
Input: maybeToList (lookup 3 [(1,11),(2,22),(3,33)])
Output: [33]
Input: maybeToList (lookup 32 [(1,'A'),(2,'B'),(3,'C')])
Output: ""
Input: maybeToList (lookup 32 [(1,11),(2,22),(3,33)])
Output: []