Yaaf.FSharp.Helper


Option

Defined in Yaaf.FSharp.Helper.dll.

Nested types and modules

TypeDescription
MaybeBuilder

The maybe monad. This monad is my own and uses an 'T option. Others generally make their own Maybe<'T> type from Option<'T>. The builder approach is from Matthew Podwysocki's excellent Creating Extended Builders series http://codebetter.com/blogs/matthew.podwysocki/archive/2010/01/18/much-ado-about-monads-creating-extended-builders.aspx.

Functions and values

Function or valueDescription
( *> ) x y
Signature: x:'?21247 option -> y:'?21248 option -> '?21248 option
Type parameters: '?21247, '?21248

Sequence actions, discarding the value of the first argument.

( <!> ) f m
Signature: f:('?21240 -> '?21241) -> m:'?21240 option -> '?21241 option
Type parameters: '?21240, '?21241

Infix map

( <* ) x y
Signature: x:'?21250 option -> y:'?21251 option -> '?21250 option
Type parameters: '?21250, '?21251

Sequence actions, discarding the value of the second argument.

( <*> ) f m
Signature: f:('?21234 -> '?21235) option -> m:'?21234 option -> '?21235 option
Type parameters: '?21234, '?21235

Sequential application

( <=< ) x
Signature: x:('?21260 -> '?21261 option) -> ('?21262 -> '?21260 option) -> '?21262 -> '?21261 option
Type parameters: '?21260, '?21261, '?21262

Right-to-left Kleisli composition

( =<< ) f m
Signature: f:('?21231 -> '?21232 option) -> m:'?21231 option -> '?21232 option
Type parameters: '?21231, '?21232

Flipped >>=

( >=> ) f g x
Signature: f:('?21256 -> '?21257 option) -> g:('?21257 -> '?21258 option) -> x:'?21256 -> '?21258 option
Type parameters: '?21256, '?21257, '?21258

Left-to-right Kleisli composition

( >>. ) m f
Signature: m:'?21253 option -> f:'?21254 option -> '?21254 option
Type parameters: '?21253, '?21254

Sequentially compose two maybe actions, discarding any value produced by the first

( >>= ) m f
Signature: m:'?21228 option -> f:('?21228 -> '?21229 option) -> '?21229 option
Type parameters: '?21228, '?21229

Sequentially compose two actions, passing any value produced by the first as an argument to the second.

ap m f
Signature: m:'?21237 option -> f:('?21237 -> '?21238) option -> '?21238 option
Type parameters: '?21237, '?21238

Sequential application

cast o
Signature: o:obj -> '?21289 option
Type parameters: '?21289

Attempts to cast an object. Returns None if unsuccessful.

concat x
Signature: x:'?21308 option option -> '?21308 option
Type parameters: '?21308

Concatenates an option of option.

filter pred _arg1
Signature: pred:('?21287 -> bool) -> _arg1:'?21287 option -> '?21287 option
Type parameters: '?21287

Applies a predicate to the option. If the predicate returns true, returns Some x, otherwise None.

foldM f s
Signature: f:('?21291 -> '?21292 -> '?21291 option) -> s:'?21291 -> seq<'?21292> -> '?21291 option
Type parameters: '?21291, '?21292
fromTryPattern tryFun input
Signature: tryFun:('input -> bool * 'output) -> input:'input -> 'output option
Type parameters: 'input, 'output

transforms a function in the Try...(input, out output) style into a function of type: input -> output Option Example: fromTryPattern(System.Double.TryParse) See Examples.Option

getOrDefault _arg1
Signature: _arg1:'?21283 option -> '?21283
Type parameters: '?21283

Gets the value associated with the option or the default value for the type.

getOrElse v _arg1
Signature: v:'?21277 -> _arg1:'?21277 option -> '?21277
Type parameters: '?21277

Gets the value associated with the option or the supplied default value.

getOrElseF v _arg1
Signature: v:(unit -> '?21281) -> _arg1:'?21281 option -> '?21281
Type parameters: '?21281

Gets the value associated with the option or the supplied default value from a function.

getOrElseLazy v _arg1
Signature: v:Lazy<'?21279> -> _arg1:'?21279 option -> '?21279
Type parameters: '?21279

Gets the value associated with the option or the supplied default value.

getOrElseWith v f _arg1
Signature: v:'?21299 -> f:('?21300 -> '?21299) -> _arg1:'?21300 option -> '?21299
Type parameters: '?21299, '?21300
lift2 f a b
Signature: f:('?21243 -> '?21244 -> '?21245) -> a:'?21243 option -> b:'?21244 option -> '?21245 option
Type parameters: '?21243, '?21244, '?21245

Promote a function to a monad/applicative, scanning the monadic/applicative arguments from left to right.

mapM f x
Signature: f:('?21296 -> '?21297 option) -> x:'?21296 list -> '?21297 list option
Type parameters: '?21296, '?21297
maybe
Signature: MaybeBuilder
monoid m
Signature: m:ISemigroup<'?21224> -> Monoid<'?21224 option>
Type parameters: '?21224

Option wrapper monoid

ofBool b
Signature: b:bool -> unit option

True -> Some(), False -> None

ofBoolAndValue (arg1, arg2)
Signature: (bool * '?21272) -> '?21272 option
Type parameters: '?21272

If true,value then returns Some value. Otherwise returns None. Useful to process TryXX style functions.

ofChoice _arg1
Signature: _arg1:Choice<'?21274,'?21275> -> '?21274 option
Type parameters: '?21274, '?21275

Maps Choice 1Of2 to Some value, otherwise None.

ofNullable n
Signature: n:Nullable<'?21264> -> '?21264 option
Type parameters: '?21264

Maps a Nullable to Option

option defaultValue map _arg1
Signature: defaultValue:'U -> map:('T -> 'U) -> _arg1:'T option -> 'U
Type parameters: 'U, 'T

Haskell-style maybe operator

orElse v _arg1
Signature: v:'?21285 option -> _arg1:'?21285 option -> '?21285 option
Type parameters: '?21285

Gets the option if Some x, otherwise the supplied default value.

returnM x
Signature: x:'?21226 -> '?21226 option
Type parameters: '?21226

Inject a value into the option type

sequence s
Signature: s:'?21294 option list -> '?21294 list option
Type parameters: '?21294
toNullable _arg1
Signature: _arg1:'?21266 option -> Nullable<'?21266>
Type parameters: '?21266

Maps an Option to Nullable

tryParseWith func
Signature: func:('?21269 -> bool * '?21270) -> '?21269 -> '?21270 option
Type parameters: '?21269, '?21270

Converts a function returning bool,value to a function returning value option. Useful to process TryXX style functions.

Fork me on GitHub