type Option a = | Some a | None
| Name | Fixity | Type | Description |
|---|---|---|---|
| some | [a] a -> Option a | op that constructs Some x | |
| none | [a] Option a | op that constructs None | |
| some? | [a] Option a -> Boolean | tests if the parameter is of the form Some x | |
| none? | [a] Option a -> Boolean | tests if the parameter is None | |
| compare | [a] (a * a -> Comparison) -> Option a * Option a -> Comparison | returns the result of the comparison of the two optional values, where None is less than Some x for all x; if both optional values are of the form Some x, the comparison function given as first parameter is used to compute the result | |
| mapOption | [a,b] (a -> b) -> Option a -> Option b | applies the function given as first parameter to the optional value if it is Some x, otherwise None is returned | |
| show | [a,b] (a -> String) -> Option a -> String | converts optional value to string; if the optional value is Some x, it uses the function given as first parameter to convert x to a string |