Frama-C:
Plug-ins:
Libraries:

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.

  • since Frama-C+dev
include module type of Stdlib.Option
val none : 'a option
val some : 'a -> 'a option
val value : 'a option -> default:'a -> 'a
val get : 'a option -> 'a
val join : 'a option option -> 'a option
val fold : none:'a -> some:('b -> 'a) -> 'b option -> 'a
val iter : ('a -> unit) -> 'a option -> unit
val is_none : 'a option -> bool
val is_some : 'a option -> bool
val equal : ('a -> 'a -> bool) -> 'a option -> 'a option -> bool
val compare : ('a -> 'a -> int) -> 'a option -> 'a option -> int
val to_result : none:'e -> 'a option -> ('a, 'e) Stdlib.result
val to_list : 'a option -> 'a list
val to_seq : 'a option -> 'a Stdlib.Seq.t
include Monad.S_with_product with type 'a t = 'a option
type 'a t = 'a option
val return : 'a -> 'a t
val flatten : 'a t t -> 'a t
val map : ('a -> 'b) -> 'a t -> 'b t
val bind : ('a -> 'b t) -> 'a t -> 'b t
val product : 'a t -> 'b t -> ('a * 'b) t
module Bool : sig ... end
module Option : sig ... end
module List : sig ... end
module Operators : sig ... end