FSharpx.Extras


Lens

Namespace: FSharpx.Functional

Nested types and modules

ModuleDescription
Operators
StateOperators

Functions and values

Function or valueDescription
arrayMap l
Signature: l:Lens<'?11563,'?11564> -> Lens<'?11563 [],'?11564 []>
Type parameters: '?11563, '?11564

Creates a lens that maps the given lens in an array

choice l1 l2
Signature: l1:Lens<'?11514,'?11515> -> l2:Lens<'?11516,'?11515> -> Lens<Choice<'?11514,'?11516>,'?11515>
Type parameters: '?11514, '?11515, '?11516

Composes two lenses through a sum in the source

codiag
Signature: Lens<Choice<'T,'T>,'T>
Type parameters: 'T
compose l1 l2
Signature: l1:Lens<'?11510,'?11511> -> l2:Lens<'?11512,'?11510> -> Lens<'?11512,'?11511>
Type parameters: '?11510, '?11511, '?11512

Sequentially composes two lenses

cond pred lensTrue lensFalse
Signature: pred:('?11523 -> bool) -> lensTrue:Lens<'?11523,'?11524> -> lensFalse:Lens<'?11523,'?11524> -> Lens<'?11523,'?11524>
Type parameters: '?11523, '?11524

is applied to source. If true, is selected. If false, is selected.

forArray i
Signature: i:int -> Lens<'?11556 [],'?11556>
Type parameters: '?11556

Lens for a particular position in an array

forList i
Signature: i:int -> Lens<'?11558 list,'?11558>
Type parameters: '?11558

Lens for a particular position in a list

forMap key
Signature: key:'?11553 -> Lens<Map<'?11553,'?11554>,'?11554 option>
Type parameters: '?11553, '?11554

Lens for a particular key in a map

forSet value
Signature: value:'?11551 -> Lens<Set<'?11551>,bool>
Type parameters: '?11551

Lens for a particular value in a set

fst
Signature: Lens<('?11541 * '?11542),'?11541>
Type parameters: '?11541, '?11542

Gets/sets the fst element in a pair

get a l
Signature: a:'?11501 -> l:Lens<'?11501,'?11502> -> '?11502
Type parameters: '?11501, '?11502
getAndModifyState l f
Signature: l:Lens<'?11535,'?11536> -> f:('?11536 -> '?11536) -> State<'?11535,'?11535>
Type parameters: '?11535, '?11536

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

getState l a
Signature: l:Lens<'?11526,'?11527> -> a:'?11526 -> '?11527 * '?11526
Type parameters: '?11526, '?11527

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

id
Signature: Lens<'?11547,'?11547>
Type parameters: '?11547

Identity lens

ignore
Signature: Lens<'?11576,unit>
Type parameters: '?11576
listMap l
Signature: l:Lens<'?11560,'?11561> -> Lens<'?11560 list,'?11561 list>
Type parameters: '?11560, '?11561

Creates a lens that maps the given lens in a list

listToArray l
Signature: l:Lens<'?11573,'?11574 list> -> Lens<'?11573,'?11574 []>
Type parameters: '?11573, '?11574

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

modifyAndGetState l f
Signature: l:Lens<'?11538,'?11539> -> f:('?11539 -> '?11539) -> State<'?11538,'?11538>
Type parameters: '?11538, '?11539

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

pair l1 l2
Signature: l1:Lens<'?11518,'?11519> -> l2:Lens<'?11520,'?11521> -> Lens<('?11518 * '?11520),('?11519 * '?11521)>
Type parameters: '?11518, '?11519, '?11520, '?11521

Pair two lenses

seqMap l
Signature: l:Lens<'?11566,'?11567> -> Lens<seq<'?11566>,seq<'?11567>>
Type parameters: '?11566, '?11567

Creates a lens that maps the given lens in a sequence

set v a l
Signature: v:'?11504 -> a:'?11505 -> l:Lens<'?11505,'?11504> -> '?11505
Type parameters: '?11504, '?11505
setState l v a
Signature: l:Lens<'?11529,'?11530> -> v:'?11530 -> a:'?11529 -> unit * '?11529
Type parameters: '?11529, '?11530

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

snd
Signature: Lens<('?11544 * '?11545),'?11545>
Type parameters: '?11544, '?11545

Gets/sets the snd element in a pair

update f l
Signature: f:('?11507 -> '?11507) -> l:Lens<'?11508,'?11507> -> '?11508 -> '?11508
Type parameters: '?11507, '?11508
updateState l f a
Signature: l:Lens<'?11532,'?11533> -> f:('?11533 -> '?11533) -> a:'?11532 -> unit * '?11532
Type parameters: '?11532, '?11533

Update through a lens within a state monad

xmap f g l
Signature: f:('?11569 -> '?11570) -> g:('?11570 -> '?11569) -> l:Lens<'?11571,'?11569> -> Lens<'?11571,'?11570>
Type parameters: '?11569, '?11570, '?11571

Applies an isomorphism to the value viewed through a lens

Fork me on GitHub