Lens

indigo.shared.utils.Lens
See theLens companion trait
object Lens

Attributes

Companion
trait
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Lens.type

Members list

Value members

Concrete methods

def apply[A, B](getter: A => B, setter: (A, B) => A): Lens[A, B]

Lens constructor

Lens constructor

Value parameters

getter

function that notionally reads a value B from a given A

setter

function that notionally sets a value B into a given A

Attributes

Returns

Lens[A, B] - a lens that in some way works with a B nested in an A

def fixed[A, B](default: B): Lens[A, B]

Fixed will always get the default argument and never set it back.

Fixed will always get the default argument and never set it back.

Attributes

def identity[A]: Lens[A, A]

A NoOp where the outer type is equal to the inner type and never changes. Alias for Lens.keepOriginal[A].

A NoOp where the outer type is equal to the inner type and never changes. Alias for Lens.keepOriginal[A].

Attributes

def keepLatest[A]: Lens[A, A]

Simple replacement. The outer type is equal to the inner type and we always keep the latest one.

Simple replacement. The outer type is equal to the inner type and we always keep the latest one.

Attributes

def keepOriginal[A]: Lens[A, A]

A NoOp where the outer type is equal to the inner type and never changes.

A NoOp where the outer type is equal to the inner type and never changes.

Attributes

def readOnly[A, B](get: A => B): Lens[A, B]

Get but don't set. Implies the value B nested in A never changes. B is read only / immutable in this scope.

Get but don't set. Implies the value B nested in A never changes. B is read only / immutable in this scope.

Attributes

def unit[A]: Lens[A, Unit]

Unit is like Lens.fixed(()) without the arguments, where there is no inner type (or rather, the inner type is hard coded to Unit)

Unit is like Lens.fixed(()) without the arguments, where there is no inner type (or rather, the inner type is hard coded to Unit)

Attributes