Yaaf.FSharp.Helper


State

Defined in Yaaf.FSharp.Helper.dll.

Nested types and modules

TypeDescription
State<'T, 'State>
StateBuilder

The state monad. The algorithm is adjusted from my original work off of Brian Beckman's http://channel9.msdn.com/shows/Going+Deep/Brian-Beckman-The-Zen-of-Expressing-State-The-State-Monad/. The approach was adjusted from Matthew Podwysocki's http://codebetter.com/blogs/matthew.podwysocki/archive/2009/12/30/much-ado-about-monads-state-edition.aspx and mirrors his final result.

Functions and values

Function or valueDescription
( *> ) x y
Signature: x:State<'?20894,'?20895> -> y:State<'?20896,'?20895> -> State<'?20896,'?20895>
Type parameters: '?20894, '?20895, '?20896

Sequence actions, discarding the value of the first argument.

( <!> ) f m
Signature: f:('?20885 -> '?20886) -> m:State<'?20885,'?20887> -> State<'?20886,'?20887>
Type parameters: '?20885, '?20886, '?20887

Infix map

( <* ) x y
Signature: x:State<'?20898,'?20899> -> y:State<'?20900,'?20899> -> State<'?20898,'?20899>
Type parameters: '?20898, '?20899, '?20900

Sequence actions, discarding the value of the second argument.

( <*> ) f m
Signature: f:State<('?20873 -> '?20874),'?20875> -> m:State<'?20873,'?20875> -> State<'?20874,'?20875>
Type parameters: '?20873, '?20874, '?20875

Sequential application

( <=< ) x
Signature: x:('?20911 -> State<'?20912,'?20913>) -> ('?20914 -> State<'?20911,'?20913>) -> '?20914 -> State<'?20912,'?20913>
Type parameters: '?20911, '?20912, '?20913, '?20914

Right-to-left Kleisli composition

( =<< ) f m
Signature: f:('?20869 -> State<'?20870,'?20871>) -> m:State<'?20869,'?20871> -> State<'?20870,'?20871>
Type parameters: '?20869, '?20870, '?20871

Flipped >>=

( >=> ) f g x
Signature: f:('?20906 -> State<'?20907,'?20908>) -> g:('?20907 -> State<'?20909,'?20908>) -> x:'?20906 -> State<'?20909,'?20908>
Type parameters: '?20906, '?20907, '?20908, '?20909

Left-to-right Kleisli composition

( >>. ) m f
Signature: m:State<'?20902,'?20903> -> f:State<'?20904,'?20903> -> State<'?20904,'?20903>
Type parameters: '?20902, '?20903, '?20904

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

( >>= ) m f
Signature: m:State<'?20865,'?20866> -> f:('?20865 -> State<'?20867,'?20866>) -> State<'?20867,'?20866>
Type parameters: '?20865, '?20866, '?20867

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

ap m f
Signature: m:State<'?20877,'?20878> -> f:State<('?20877 -> '?20879),'?20878> -> State<'?20879,'?20878>
Type parameters: '?20877, '?20878, '?20879

Sequential application

bind k m s
Signature: k:('?20822 -> '?20823 -> '?20824) -> m:('?20825 -> '?20822 * '?20823) -> s:'?20825 -> '?20824
Type parameters: '?20822, '?20823, '?20824, '?20825
empty s
Signature: s:'?20820 -> unit * '?20820
Type parameters: '?20820
eval m s
Signature: m:('?20812 -> '?20813 * '?20814) -> s:'?20812 -> '?20813
Type parameters: '?20812, '?20813, '?20814
exec m s
Signature: m:('?20816 -> '?20817 * '?20818) -> s:'?20816 -> '?20818
Type parameters: '?20816, '?20817, '?20818
foldM f s
Signature: f:('?20916 -> '?20917 -> State<'?20916,'?20918>) -> s:'?20916 -> seq<'?20917> -> State<'?20916,'?20918>
Type parameters: '?20916, '?20917, '?20918
getState s
Signature: s:'?20807 -> '?20807 * '?20807
Type parameters: '?20807
lift2 f a b
Signature: f:('?20889 -> '?20890 -> '?20891) -> a:State<'?20889,'?20892> -> b:State<'?20890,'?20892> -> State<'?20891,'?20892>
Type parameters: '?20889, '?20890, '?20891, '?20892

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

map f m
Signature: f:('?20881 -> '?20882) -> m:State<'?20881,'?20883> -> State<'?20882,'?20883>
Type parameters: '?20881, '?20882, '?20883

Transforms a State value by using a specified mapping function.

mapM f x
Signature: f:('?20923 -> State<'?20924,'?20925>) -> x:'?20923 list -> State<'?20924 list,'?20925>
Type parameters: '?20923, '?20924, '?20925
putState s arg2
Signature: s:'?20809 -> '?20810 -> unit * '?20809
Type parameters: '?20809, '?20810
returnM x
Signature: x:'?20862 -> State<'?20862,'?20863>
Type parameters: '?20862, '?20863

Inject a value into the State type

sequence s
Signature: s:State<'?20920,'?20921> list -> State<'?20920 list,'?20921>
Type parameters: '?20920, '?20921
state
Signature: StateBuilder
Fork me on GitHub