FSharpx.Extras


Reader Module

Types

Type Description

Reader<'R, 'T>

ReaderBuilder

The reader monad. This monad comes from Matthew Podwysocki's http://codebetter.com/blogs/matthew.podwysocki/archive/2010/01/07/much-ado-about-monads-reader-edition.aspx.

Functions and values

Function or value Description

x *> y

Full Usage: x *> y

Parameters:
Returns: Reader<'a, 'c>
Modifiers: inline

Sequence actions, discarding the value of the first argument.

x : Reader<'a, 'b>
y : Reader<'a, 'c>
Returns: Reader<'a, 'c>

x <* y

Full Usage: x <* y

Parameters:
Returns: Reader<'a, 'b>
Modifiers: inline

Sequence actions, discarding the value of the second argument.

x : Reader<'a, 'b>
y : Reader<'a, 'c>
Returns: Reader<'a, 'b>

f <!> m

Full Usage: f <!> m

Parameters:
    f : 'a -> 'b
    m : Reader<'c, 'a>

Returns: Reader<'c, 'b>
Modifiers: inline

Infix map

f : 'a -> 'b
m : Reader<'c, 'a>
Returns: Reader<'c, 'b>

f <*> m

Full Usage: f <*> m

Parameters:
Returns: Reader<'a, 'c>
Modifiers: inline

Sequential application

f : Reader<'a, ('b -> 'c)>
m : Reader<'a, 'b>
Returns: Reader<'a, 'c>

<=<x

Full Usage: <=<x

Parameters:
Returns: ('d -> Reader<'b, 'a>) -> 'd -> Reader<'b, 'c>
Modifiers: inline

Right-to-left Kleisli composition

x : 'a -> Reader<'b, 'c>
Returns: ('d -> Reader<'b, 'a>) -> 'd -> Reader<'b, 'c>

f =<< m

Full Usage: f =<< m

Parameters:
Returns: Reader<'b, 'c>
Modifiers: inline

Flipped >>=

f : 'a -> Reader<'b, 'c>
m : Reader<'b, 'a>
Returns: Reader<'b, 'c>

(>=>) f g x

Full Usage: (>=>) f g x

Parameters:
Returns: Reader<'b, 'd>
Modifiers: inline

Left-to-right Kleisli composition

f : 'a -> Reader<'b, 'c>
g : 'c -> Reader<'b, 'd>
x : 'a
Returns: Reader<'b, 'd>

m >>. f

Full Usage: m >>. f

Parameters:
Returns: Reader<'a, 'c>
Modifiers: inline

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

m : Reader<'a, 'b>
f : Reader<'a, 'c>
Returns: Reader<'a, 'c>

m >>= f

Full Usage: m >>= f

Parameters:
Returns: Reader<'a, 'c>
Modifiers: inline

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

m : Reader<'a, 'b>
f : 'b -> Reader<'a, 'c>
Returns: Reader<'a, 'c>

ap m f

Full Usage: ap m f

Parameters:
Returns: Reader<'a, 'c>
Modifiers: inline

Sequential application

m : Reader<'a, 'b>
f : Reader<'a, ('b -> 'c)>
Returns: Reader<'a, 'c>

ask

Full Usage: ask

Returns: Reader<'R, 'R>
Returns: Reader<'R, 'R>

asks f

Full Usage: asks f

Parameters:
    f : 'a -> 'b

Returns: Reader<'a, 'b>
f : 'a -> 'b
Returns: Reader<'a, 'b>

bind k m r

Full Usage: bind k m r

Parameters:
    k : 'a -> 'b -> 'c
    m : 'b -> 'a
    r : 'b

Returns: 'c
k : 'a -> 'b -> 'c
m : 'b -> 'a
r : 'b
Returns: 'c

foldM f s

Full Usage: foldM f s

Parameters:
    f : 'a -> 'b -> Reader<'c, 'a>
    s : 'a

Returns: 'b seq -> Reader<'c, 'a>
f : 'a -> 'b -> Reader<'c, 'a>
s : 'a
Returns: 'b seq -> Reader<'c, 'a>

lift2 f a b

Full Usage: lift2 f a b

Parameters:
Returns: Reader<'d, 'c>
Modifiers: inline

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

f : 'a -> 'b -> 'c
a : Reader<'d, 'a>
b : Reader<'d, 'b>
Returns: Reader<'d, 'c>

local f m

Full Usage: local f m

Parameters:
    f : 'r1 -> 'r2
    m : Reader<'r2, 'T>

Returns: Reader<'r1, 'T>
f : 'r1 -> 'r2
m : Reader<'r2, 'T>
Returns: Reader<'r1, 'T>

map f m

Full Usage: map f m

Parameters:
    f : 'a -> 'b
    m : Reader<'c, 'a>

Returns: Reader<'c, 'b>
Modifiers: inline

Transforms a Reader value by using a specified mapping function.

f : 'a -> 'b
m : Reader<'c, 'a>
Returns: Reader<'c, 'b>

mapM f x

Full Usage: mapM f x

Parameters:
    f : 'a -> Reader<'b, 'c>
    x : 'a list

Returns: Reader<'b, 'c list>
Modifiers: inline
f : 'a -> Reader<'b, 'c>
x : 'a list
Returns: Reader<'b, 'c list>

reader

Full Usage: reader

Returns: ReaderBuilder
Returns: ReaderBuilder

returnM x

Full Usage: returnM x

Parameters:
    x : 'a

Returns: Reader<'b, 'a>
Modifiers: inline

Inject a value into the Reader type

x : 'a
Returns: Reader<'b, 'a>

sequence s

Full Usage: sequence s

Parameters:
Returns: Reader<'a, 'b list>
Modifiers: inline
s : Reader<'a, 'b> list
Returns: Reader<'a, 'b list>