Skip to content

ribs_optics

Functional optics library for Dart.

Provides composable abstractions like Lens, Prism, Iso, Optional, Getter, and Setter for inspecting and updating immutable data structures.

Classes

ClassDescription
Fold<S, A>An optic that can find zero or more focus values of type A within a structure S.
Getter<S, A>A read-only optic that extracts exactly one value of type A from a structure S.
PIso<S, T, A, B>An optic representing a lossless, reversible conversion between types S and A.
PLens<S, T, A, B>An optic that focuses on exactly one value of type A within a structure S, with the ability to both read and modify.
POptional<S, T, A, B>An optic that focuses on zero or one value of type A within a structure S, with the ability to read and modify.
PPrism<S, T, A, B>An optic that focuses on a value of type A that may or may not be present within a sum type S, with the ability to construct T from B.
PSetter<S, T, A, B>A write-only optic that can transform a focus A into B within a structure S, producing a new structure T.

Typedefs

TypedefDescription
Iso<S, A>A PIso where the source and target types are the same.
Lens<S, A>A PLens where the source and target types are the same.
Optional<S, A>A POptional where the source and target types are the same.
Prism<S, A>A PPrism where the source and target types are the same.
Setter<S, A>A PSetter where the source and target types are the same.