Module Option


module Option: sig .. end
Functions for the Option type.

val is_some : 'a option -> bool
Does an option contain a value?


val is_none : 'a option -> bool
Does an option contain no value?


val value : 'a option -> 'a
The value contained in an option.
Raises Invalid_argument when applied to None.


val default : 'a -> 'a option -> 'a
The value contained in an option, or a default if there is none.


val classify : ('a -> bool) -> 'a -> 'a option
Classify a value by placing it in an option.


val perform : ('a -> unit) -> 'a option -> unit
Perform a command on the value in an option.

apply c (Some x) does c x, while apply f None does nothing.

val map : ('a -> 'b) -> 'a option -> 'b option
Map a function over the value in an option.


val filter : ('a -> bool) -> 'a option -> 'a option
Filter the value in an option.

filter p (Some x) is Some x when p x holds and None otherwise, while filter p None is None.

val flatten : 'a option option -> 'a option
Flatten a doubly optional value.



Hosted by the SourceForge.net Logo* web site.
*Other names and brands may be claimed as the property of others.