Step

Step

A step within a Lens with fully customizable behavior

Constructor

new Step(get_maybe, updatedClone, construct)

Source:

If standard logic for accessing data deeper in the conceptual structure is not adequate, an instance of this class may be passed as a step in a Lens, which will allow the Lens to have custom behavior.

Passing null for any of these functions will limit the functionality of the lens: skipping either construct or updatedClone will prevent the lens from constructing a missing container, skipping updatedClone will additionally prevent the lens from modifying an existing container, and skipping get_maybe will prevent retrieving or transforming values in a subject.

Parameters:
Name Type Description
get_maybe Step~Get_Maybe

Returns a Maybe value for the slot within the container it is passed.

updatedClone Step~UpdatedClone

Takes the current container and a Maybe of this step's slot value, returning a minimally modified clone of the container such that get_maybe will return the value_maybe passed to this function.

construct Step~Construct

Instantiate an empty container of the type this step navigates.

Type Definitions

Construct()

Source:
Returns:

The empty container type corresponding to this step

Get_Maybe(container) → {Maybe.<*>}

Source:

Gets the value of this slot within the passed container, returning {} if the slot does not exist.

Parameters:
Name Type Description
container *
Returns:

A Maybe monad value for the represented slot within container

Type
Maybe.<*>

UpdatedClone(container, value_maybe)

Source:
Parameters:
Name Type Description
container *
value_maybe Maybe.<*>
Properties
Name Type Attributes Description
just * <optional>

The value to assign into the target slot in the clone

Returns:

The minimally modified clone of container