Frama-C API - Option
Extend the option type to a full fleshed monad. Be wary that the parameters order of the bind function are reversed compared to the standard library.
include Monad.S_with_product with type 'a t = 'a option
val return : 'a -> 'a optionval flatten : 'a option option -> 'a optionval product : 'a option -> 'b option -> ('a * 'b) optionmodule Bool : sig ... endmodule List : sig ... endinclude module type of Stdlib.Option
type !'a t = 'a option = | None| Some of 'a
val some : 'a -> 'a optionval value : 'a option -> default:'a -> 'aval get : 'a option -> 'aval join : 'a option option -> 'a optionval map : ('a -> 'b) -> 'a option -> 'b optionval fold : none:'a -> some:('b -> 'a) -> 'b option -> 'aval iter : ('a -> unit) -> 'a option -> unitval is_none : 'a option -> boolval is_some : 'a option -> boolval equal : ('a -> 'a -> bool) -> 'a option -> 'a option -> boolval compare : ('a -> 'a -> int) -> 'a option -> 'a option -> intval to_result : none:'e -> 'a option -> ('a, 'e) Stdlib.resultval to_list : 'a option -> 'a listval to_seq : 'a option -> 'a Stdlib.Seq.tval bind : ('a -> 'b t) -> 'a t -> 'b tReverse Stdlib.Option.bind parameters for monad compatibility. bind f o is f v if o is Some v and None if o is None.