FSharpx.Extras


Lens Module

Nested modules

Modules Description

Operators

StateOperators

Functions and values

Function or value Description

arrayMap l

Full Usage: arrayMap l

Parameters:
Returns: Lens<'a[], 'b[]>

Creates a lens that maps the given lens in an array

l : Lens<'a, 'b>
Returns: Lens<'a[], 'b[]>

choice l1 l2

Full Usage: choice l1 l2

Parameters:
Returns: Lens<Choice<'a, 'c>, 'b>
Modifiers: inline

Composes two lenses through a sum in the source

l1 : Lens<'a, 'b>
l2 : Lens<'c, 'b>
Returns: Lens<Choice<'a, 'c>, 'b>

codiag

Full Usage: codiag

Returns: Lens<Choice<'T, 'T>, 'T>
Returns: Lens<Choice<'T, 'T>, 'T>

compose l1 l2

Full Usage: compose l1 l2

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

Sequentially composes two lenses

l1 : Lens<'a, 'b>
l2 : Lens<'c, 'a>
Returns: Lens<'c, 'b>

cond pred lensTrue lensFalse

Full Usage: cond pred lensTrue lensFalse

Parameters:
    pred : 'a -> bool
    lensTrue : Lens<'a, 'b>
    lensFalse : Lens<'a, 'b>

Returns: Lens<'a, 'b>

pred is applied to source. If true, lensTrue is selected. If false, lensFalse is selected.

pred : 'a -> bool
lensTrue : Lens<'a, 'b>
lensFalse : Lens<'a, 'b>
Returns: Lens<'a, 'b>

forArray i

Full Usage: forArray i

Parameters:
    i : int

Returns: Lens<'a[], 'a>

Lens for a particular position in an array

i : int
Returns: Lens<'a[], 'a>

forList i

Full Usage: forList i

Parameters:
    i : int

Returns: Lens<'a list, 'a>

Lens for a particular position in a list

i : int
Returns: Lens<'a list, 'a>

forMap key

Full Usage: forMap key

Parameters:
    key : 'a

Returns: Lens<Map<'a, 'b>, 'b option>

Lens for a particular key in a map

key : 'a
Returns: Lens<Map<'a, 'b>, 'b option>

forSet value

Full Usage: forSet value

Parameters:
    value : 'a

Returns: Lens<Set<'a>, bool>

Lens for a particular value in a set

value : 'a
Returns: Lens<Set<'a>, bool>

fst

Full Usage: fst

Returns: Lens<('a * 'b), 'a>

Gets/sets the fst element in a pair

Returns: Lens<('a * 'b), 'a>

get a l

Full Usage: get a l

Parameters:
    a : 'a
    l : Lens<'a, 'b>

Returns: 'b
Modifiers: inline
a : 'a
l : Lens<'a, 'b>
Returns: 'b

getAndModifyState l f

Full Usage: getAndModifyState l f

Parameters:
    l : Lens<'a, 'b>
    f : 'b -> 'b

Returns: State<'a, 'a>

Modifies the state in a state monad and returns the original value.

l : Lens<'a, 'b>
f : 'b -> 'b
Returns: State<'a, 'a>

getState l a

Full Usage: getState l a

Parameters:
    l : Lens<'a, 'b>
    a : 'a

Returns: 'b * 'a

Applies a lens in the 'get' direction within a state monad

l : Lens<'a, 'b>
a : 'a
Returns: 'b * 'a

id

Full Usage: id

Returns: Lens<'a, 'a>

Identity lens

Returns: Lens<'a, 'a>

ignore

Full Usage: ignore

Returns: Lens<'a, unit>
Returns: Lens<'a, unit>

listMap l

Full Usage: listMap l

Parameters:
Returns: Lens<'a list, 'b list>

Creates a lens that maps the given lens in a list

l : Lens<'a, 'b>
Returns: Lens<'a list, 'b list>

listToArray l

Full Usage: listToArray l

Parameters:
    l : Lens<'a, 'b list>

Returns: Lens<'a, 'b[]>
Modifiers: inline

Converts a lens that views a list into a lens that views an array

l : Lens<'a, 'b list>
Returns: Lens<'a, 'b[]>

modifyAndGetState l f

Full Usage: modifyAndGetState l f

Parameters:
    l : Lens<'a, 'b>
    f : 'b -> 'b

Returns: State<'a, 'a>

Modifies the state in a state monad and returns the modified value.

l : Lens<'a, 'b>
f : 'b -> 'b
Returns: State<'a, 'a>

pair l1 l2

Full Usage: pair l1 l2

Parameters:
Returns: Lens<('a * 'c), ('b * 'd)>
Modifiers: inline

Pair two lenses

l1 : Lens<'a, 'b>
l2 : Lens<'c, 'd>
Returns: Lens<('a * 'c), ('b * 'd)>

seqMap l

Full Usage: seqMap l

Parameters:
Returns: Lens<'a seq, 'b seq>

Creates a lens that maps the given lens in a sequence

l : Lens<'a, 'b>
Returns: Lens<'a seq, 'b seq>

set v a l

Full Usage: set v a l

Parameters:
    v : 'a
    a : 'b
    l : Lens<'b, 'a>

Returns: 'b
Modifiers: inline
v : 'a
a : 'b
l : Lens<'b, 'a>
Returns: 'b

setState l v a

Full Usage: setState l v a

Parameters:
    l : Lens<'a, 'b>
    v : 'b
    a : 'a

Returns: unit * 'a

Applies a lens in the 'set' direction within a state monad

l : Lens<'a, 'b>
v : 'b
a : 'a
Returns: unit * 'a

snd

Full Usage: snd

Returns: Lens<('a * 'b), 'b>

Gets/sets the snd element in a pair

Returns: Lens<('a * 'b), 'b>

update f l

Full Usage: update f l

Parameters:
    f : 'a -> 'a
    l : Lens<'b, 'a>

Returns: 'b -> 'b
Modifiers: inline
f : 'a -> 'a
l : Lens<'b, 'a>
Returns: 'b -> 'b

updateState l f a

Full Usage: updateState l f a

Parameters:
    l : Lens<'a, 'b>
    f : 'b -> 'b
    a : 'a

Returns: unit * 'a

Update through a lens within a state monad

l : Lens<'a, 'b>
f : 'b -> 'b
a : 'a
Returns: unit * 'a

xmap f g l

Full Usage: xmap f g l

Parameters:
    f : 'a -> 'b
    g : 'b -> 'a
    l : Lens<'c, 'a>

Returns: Lens<'c, 'b>

Applies an isomorphism to the value viewed through a lens

f : 'a -> 'b
g : 'b -> 'a
l : Lens<'c, 'a>
Returns: Lens<'c, 'b>