Option

Sort

sort Option a = | Some a | None

Ops

Name Fixity Sort Description
some  fa(a) a -> Option a op that constructs Some x
none  fa(a) Option a op that constructs None
some?  fa(a) Option a -> Boolean tests if the parameter is of the form Some x
none?  fa(a) Option a -> Boolean tests if the parameter is None
compare  fa(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  fa(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  fa(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