FSharpx.Extras


Writer Module

Types

Type Description

Writer<'W, 'T>

WriterBuilder<'W>

The writer monad. This monad comes from Matthew Podwysocki's http://codebetter.com/blogs/matthew.podwysocki/archive/2010/02/01/a-kick-in-the-monads-writer-edition.aspx.

Functions and values

Function or value Description

x *> y

Full Usage: x *> y

Parameters:
Returns: Writer<string list, 'b>
Modifiers: inline

Sequence actions, discarding the value of the first argument.

x : Writer<string list, 'a>
y : Writer<string list, 'b>
Returns: Writer<string list, 'b>

x <* y

Full Usage: x <* y

Parameters:
Returns: Writer<string list, 'a>
Modifiers: inline

Sequence actions, discarding the value of the second argument.

x : Writer<string list, 'a>
y : Writer<string list, 'b>
Returns: Writer<string list, 'a>

f <!> m

Full Usage: f <!> m

Parameters:
    f : 'a -> 'b
    m : Writer<string list, 'a>

Returns: Writer<string list, 'b>
Modifiers: inline

Infix map

f : 'a -> 'b
m : Writer<string list, 'a>
Returns: Writer<string list, 'b>

f <*> m

Full Usage: f <*> m

Parameters:
    f : Writer<string list, ('a -> 'b)>
    m : Writer<string list, 'a>

Returns: Writer<string list, 'b>
Modifiers: inline

Sequential application

f : Writer<string list, ('a -> 'b)>
m : Writer<string list, 'a>
Returns: Writer<string list, 'b>

<=<x

Full Usage: <=<x

Parameters:
    x : 'a -> Writer<string list, 'b>

Returns: ('c -> Writer<string list, 'a>) -> 'c -> Writer<string list, 'b>
Modifiers: inline

Right-to-left Kleisli composition

x : 'a -> Writer<string list, 'b>
Returns: ('c -> Writer<string list, 'a>) -> 'c -> Writer<string list, 'b>

f =<< m

Full Usage: f =<< m

Parameters:
    f : 'a -> Writer<string list, 'b>
    m : Writer<string list, 'a>

Returns: Writer<string list, 'b>
Modifiers: inline

Flipped >>=

f : 'a -> Writer<string list, 'b>
m : Writer<string list, 'a>
Returns: Writer<string list, 'b>

(>=>) f g x

Full Usage: (>=>) f g x

Parameters:
    f : 'a -> Writer<string list, 'b>
    g : 'b -> Writer<string list, 'c>
    x : 'a

Returns: Writer<string list, 'c>
Modifiers: inline

Left-to-right Kleisli composition

f : 'a -> Writer<string list, 'b>
g : 'b -> Writer<string list, 'c>
x : 'a
Returns: Writer<string list, 'c>

m >>. f

Full Usage: m >>. f

Parameters:
Returns: Writer<string list, 'b>
Modifiers: inline

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

m : Writer<string list, 'a>
f : Writer<string list, 'b>
Returns: Writer<string list, 'b>

m >>= f

Full Usage: m >>= f

Parameters:
    m : Writer<string list, 'a>
    f : 'a -> Writer<string list, 'b>

Returns: Writer<string list, 'b>
Modifiers: inline

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

m : Writer<string list, 'a>
f : 'a -> Writer<string list, 'b>
Returns: Writer<string list, 'b>

ap m f

Full Usage: ap m f

Parameters:
    m : Writer<string list, 'a>
    f : Writer<string list, ('a -> 'b)>

Returns: Writer<string list, 'b>
Modifiers: inline

Sequential application

m : Writer<string list, 'a>
f : Writer<string list, ('a -> 'b)>
Returns: Writer<string list, 'b>

bind m k writer ()

Full Usage: bind m k writer ()

Parameters:
Returns: 'U * 'W
m : Monoid<'W>
k : 'T -> Writer<'W, 'U>
writer : Writer<'W, 'T>
() : unit
Returns: 'U * 'W

censor monoid f m

Full Usage: censor monoid f m

Parameters:
Returns: Writer<'w2, 'T>
monoid : Monoid<'w1>
f : 'w1 -> 'w2
m : Writer<'w1, 'T>
Returns: Writer<'w2, 'T>

foldM f s

Full Usage: foldM f s

Parameters:
    f : 'a -> 'b -> Writer<string list, 'a>
    s : 'a

Returns: 'b seq -> Writer<string list, 'a>
f : 'a -> 'b -> Writer<string list, 'a>
s : 'a
Returns: 'b seq -> Writer<string list, 'a>

lift2 f a b

Full Usage: lift2 f a b

Parameters:
    f : 'a -> 'b -> 'c
    a : Writer<string list, 'a>
    b : Writer<string list, 'b>

Returns: Writer<string list, 'c>
Modifiers: inline

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

f : 'a -> 'b -> 'c
a : Writer<string list, 'a>
b : Writer<string list, 'b>
Returns: Writer<string list, 'c>

listen m ()

Full Usage: listen m ()

Parameters:
    m : unit -> 'a * 'b
    () : unit

Returns: ('a * 'b) * 'b
m : unit -> 'a * 'b
() : unit
Returns: ('a * 'b) * 'b

listens monoid f m

Full Usage: listens monoid f m

Parameters:
    monoid : Monoid<'a>
    f : 'b -> 'c
    m : Writer<'a, ('d * 'b)>

Returns: unit -> ('d * 'c) * 'a
monoid : Monoid<'a>
f : 'b -> 'c
m : Writer<'a, ('d * 'b)>
Returns: unit -> ('d * 'c) * 'a

map f m

Full Usage: map f m

Parameters:
    f : 'a -> 'b
    m : Writer<string list, 'a>

Returns: Writer<string list, 'b>
Modifiers: inline

Transforms a Writer value by using a specified mapping function.

f : 'a -> 'b
m : Writer<string list, 'a>
Returns: Writer<string list, 'b>

mapM f x

Full Usage: mapM f x

Parameters:
    f : 'a -> Writer<string list, 'b>
    x : 'a list

Returns: Writer<string list, 'b list>
Modifiers: inline
f : 'a -> Writer<string list, 'b>
x : 'a list
Returns: Writer<string list, 'b list>

pass m ()

Full Usage: pass m ()

Parameters:
    m : unit -> ('a * ('b -> 'c)) * 'b
    () : unit

Returns: 'a * 'c
m : unit -> ('a * ('b -> 'c)) * 'b
() : unit
Returns: 'a * 'c

returnM monoid a ()

Full Usage: returnM monoid a ()

Parameters:
    monoid : Monoid<'a>
    a : 'b
    () : unit

Returns: 'b * 'a

Inject a value into the Writer type

monoid : Monoid<'a>
a : 'b
() : unit
Returns: 'b * 'a

sequence s

Full Usage: sequence s

Parameters:
    s : Writer<string list, 'a> list

Returns: Writer<string list, 'a list>
Modifiers: inline
s : Writer<string list, 'a> list
Returns: Writer<string list, 'a list>

tell w ()

Full Usage: tell w ()

Parameters:
    w : 'a
    () : unit

Returns: unit * 'a
w : 'a
() : unit
Returns: unit * 'a

writer

Full Usage: writer

Returns: WriterBuilder<string list>
Returns: WriterBuilder<string list>