//========================================================================= // (c) Microsoft Corporation 2005-2009. //========================================================================= namespace Microsoft.FSharp.Core open System open Microsoft.FSharp.Core open Microsoft.FSharp.Collections open Microsoft.FSharp.Core.Operators open Microsoft.FSharp.Collections [] /// Basic operations on options. module Option = /// Returns true if the option is not None val isSome: option:'T option -> bool /// Returns true if the option is None val isNone: option:'T option -> bool /// Gets the value associated with the option. If the option is None then /// raises ArgumentException val get: option:'T option -> 'T /// length inp evaluates to match inp with None -> 0 | Some _ -> 1 val count: option:'T option -> int /// fold_left f s inp evaluates to match inp with None -> s | Some x -> f s x val fold: folder:('State -> 'T -> 'State) -> state:'State -> option:'T option -> 'State /// fold_right f inp s evaluates to "match inp with None -> s | Some x -> f x s" val foldBack: folder:('T -> 'State -> 'State) -> option:'T option -> state:'State -> 'State /// exists p inp evaluates to match inp with None -> false | Some x -> p x val exists: predicate:('T -> bool) -> option:'T option -> bool /// forall p inp" evaluates to "match inp with None -> true | Some x -> p x val forall: predicate:('T -> bool) -> option:'T option -> bool /// iter f inp executes match inp with None -> () | Some x -> f x val iter: action:('T -> unit) -> option:'T option -> unit /// map f inp evaluates to match inp with None -> None | Some x -> Some (f x) val map: mapping:('T -> 'U) -> option:'T option -> 'U option /// bind f inp evaluates to match inp with None -> None | Some x -> f x val bind: binder:('T -> 'U option) -> option:'T option -> 'U option /// Convert the option to an array of length 0 or 1 val to_array: option:'T option -> 'T array /// Convert the option to a list of length 0 or 1 val to_list: option:'T option -> 'T list #if DONT_INCLUDE_DEPRECATED #else [] val is_some: option:'T option -> bool [] val is_none: option:'T option -> bool [] val fold_left: folder:('State -> 'T -> 'State) -> state:'State -> option:'T option -> 'State [] val fold_right: folder:('T -> 'State -> 'State) -> option:'T option -> state:'State -> 'State [] val for_all: predicate:('T -> bool) -> option:'T option -> bool /// filter p inp evaluates to match inp with None -> None | Some x -> if p x then inp else None [] val filter: predicate:('T -> bool) -> option:'T option -> 'T option /// filter p inp evaluates to match inp with None -> None | Some x -> if p x then inp else None [] val length: option:'T option -> int /// partition p inp evaluates to /// match inp with None -> None,None | Some x -> if p x then inp,None else None,inp [] val partition: predicate:('T -> bool) -> option:'T option -> ('T option * 'T option) #endif