| 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: | fromMaybe |
| Type: | a -> Maybe a -> a |
| Description: | If the argument is Just, it returns the Just value, otherwise it returns the default value provided as the first argument |
| Related: | fromJust, mapMaybe, maybeToList |
Input: fromMaybe 'X' (lookup 3 [(1,'A'),(2,'B'),(3,'C')])
Output: 'C'
Input: fromMaybe 'X' (lookup 32 [(1,'A'),(2,'B'),(3,'C')])
Output: 'X'