Header menu logo Nu

Lens Module

Lens functions.

Functions and values

Function or value Description

Lens.changeEvent lens

Full Usage: Lens.changeEvent lens

Parameters:
    lens : Lens<'a, 's>

Returns: ChangeData Address
Modifiers: inline
Type parameters: 'a, 's

The change event associated with the lensed property.

lens : Lens<'a, 's>
Returns: ChangeData Address

Lens.get lens world

Full Usage: Lens.get lens world

Parameters:
Returns: 'a
Modifiers: inline
Type parameters: 'a, 's

Get the value of a lensed property.

lens : Lens<'a, 's>
world : World
Returns: 'a

Lens.getBy by lens world

Full Usage: Lens.getBy by lens world

Parameters:
    by : 'a -> 'b
    lens : Lens<'a, 's>
    world : World

Returns: 'b
Modifiers: inline
Type parameters: 'a, 'b, 's

Get the lensed value mapped by the `by` function.

by : 'a -> 'b
lens : Lens<'a, 's>
world : World
Returns: 'b

Lens.getByPlus by lens world

Full Usage: Lens.getByPlus by lens world

Parameters:
Returns: 'b
Modifiers: inline
Type parameters: 'a, 'b, 's

Get the lensed value mapped by the `by` function that includes the world value in its input.

by : 'a -> World -> 'b
lens : Lens<'a, 's>
world : World
Returns: 'b

Lens.make name this get set

Full Usage: Lens.make name this get set

Parameters:
    name : string
    this : 's
    get : World -> 'a
    set : 'a -> World -> unit

Returns: Lens<'a, 's>

Make a writable lens.

name : string
this : 's
get : World -> 'a
set : 'a -> World -> unit
Returns: Lens<'a, 's>

Lens.makeReadOnly name this get

Full Usage: Lens.makeReadOnly name this get

Parameters:
    name : string
    this : 's
    get : World -> 'a

Returns: Lens<'a, 's>

Make a read-only lens.

name : string
this : 's
get : World -> 'a
Returns: Lens<'a, 's>

Lens.map mapper lens world

Full Usage: Lens.map mapper lens world

Parameters:
    mapper : 'a -> 'a
    lens : Lens<'a, 's>
    world : World

Modifiers: inline
Type parameters: 'a, 's

Update the lensed property's value using the given mapper function. Throws an exception if the lens is readonly.

mapper : 'a -> 'a
lens : Lens<'a, 's>
world : World

Lens.mapPlus mapper lens world

Full Usage: Lens.mapPlus mapper lens world

Parameters:
Modifiers: inline
Type parameters: 'a, 's

Update the lensed property's value using the given mapper function that also receives the world as input. Throws an exception if the lens is readonly.

mapper : 'a -> World -> 'a
lens : Lens<'a, 's>
world : World

Lens.name lens

Full Usage: Lens.name lens

Parameters:
    lens : Lens<'a, 's>

Returns: string
Modifiers: inline
Type parameters: 'a, 's

Get the name of a lens.

lens : Lens<'a, 's>
Returns: string

Lens.set a lens world

Full Usage: Lens.set a lens world

Parameters:
Modifiers: inline
Type parameters: 'a, 's

Set the lensed property to the given value. Throws an exception if the lens is readonly.

a : 'a
lens : Lens<'a, 's>
world : World

Lens.tryMap mapper lens world

Full Usage: Lens.tryMap mapper lens world

Parameters:
    mapper : 'a -> 'a
    lens : Lens<'a, 's>
    world : World

Returns: bool
Modifiers: inline
Type parameters: 'a, 's

Attempt to transform the lensed property's value using the given mapper function.

mapper : 'a -> 'a
lens : Lens<'a, 's>
world : World
Returns: bool

Lens.tryMapPlus mapper lens world

Full Usage: Lens.tryMapPlus mapper lens world

Parameters:
Returns: bool
Modifiers: inline
Type parameters: 'a, 's

Attempt to transform the lensed property's value using the given mapper function that also receives the world as input.

mapper : 'a -> World -> 'a
lens : Lens<'a, 's>
world : World
Returns: bool

Lens.trySet a lens world

Full Usage: Lens.trySet a lens world

Parameters:
Returns: bool
Modifiers: inline
Type parameters: 'a, 's

Attempt to set the lensed property to the given value.

a : 'a
lens : Lens<'a, 's>
world : World
Returns: bool

Lens.ty lens

Full Usage: Lens.ty lens

Parameters:
    lens : Lens<'a, 's>

Returns: Type
Modifiers: inline
Type parameters: 'a, 's

The type of the lensed property.

lens : Lens<'a, 's>
Returns: Type

Type something to start searching.