signature OPTION
structure Option : OPTION
An extended version of the Standard ML Basis' Option structure.
The type option and its constructors, the exception Option and the functions isSome, isNone, valOf and getOpt are available in the top-level environment.
See also: Alt
Imported implicitly.
signature OPTION =
sig
datatype 'a option = NONE | SOME of 'a
type 'a t = 'a option
exception Option
val equal : ('a * 'a -> bool) -> 'a option * 'a option -> bool
val collate : ('a * 'a -> order) -> 'a option * 'a option -> order
val isSome : 'a option -> bool
val isNone : 'a option -> bool
val valOf : 'a option -> 'a
val getOpt : 'a option * 'a -> 'a
val filter : ('a -> bool) -> 'a -> 'a option
val join : 'a option option -> 'a option
val app : ('a -> unit) -> 'a option -> unit
val map : ('a -> 'b) -> 'a option -> 'b option
val mapPartial : ('a -> 'b option) -> 'a option -> 'b option
val fold : ('a * 'b -> 'b) -> 'b -> 'a option -> 'b
val compose : ('a -> 'c) * ('b -> 'a option) -> 'b -> 'c option
val composePartial : ('a -> 'c option) * ('b -> 'a option) -> 'b -> 'c option
end
Items not described here are as in the Standard ML Basis' Option structure.
A local synonym for type option.
Returns true if opt is NONE, false otherwise. This function is the negation of the function isSome.
Returns f (v,b) if opt is SOME v, and b otherwise.
Creates an equality function on options, given a suitable equality function for the constituent type.
Performs comparison on options, given a suitable ordering function f on the constituent type. The constructed ordering is defined as follows:
fun collate f =
fn (NONE, NONE) => EQUAL
| (NONE, SOME _) => LESS
| (SOME _, NONE) => GREATER
| (SOME x, SOME y) => f (x, y)