PrismLaws

dev.constructive.eo.laws.PrismLaws
trait PrismLaws[S, A]

Law equations for a Prism[S, A]Optic[S, S, A, A, Either].

Ported from Monocle's monocle.law.PrismLaws. The getOption convenience mirrors Monocle's member of the same name, recovered from EO's primitive to: S => Either[S, A].

Attributes

Source
PrismLaws.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

def prism: Optic[S, S, A, A, Either]

The optic under test.

The optic under test.

Attributes

Source
PrismLaws.scala

Concrete methods

def composeModify(s: S, f: A => A, g: A => A): Boolean

modify(g) ∘ modify(f) == modify(f andThen g).

modify(g) ∘ modify(f) == modify(f andThen g).

Attributes

Source
PrismLaws.scala
def consistentGetOptionModifyId(s: S): Boolean

getOption survives a no-op modify: getOption(modify(identity)(s)) == getOption(s).

getOption survives a no-op modify: getOption(modify(identity)(s)) == getOption(s).

Attributes

Source
PrismLaws.scala
def getOption(s: S): Option[A]

Mirror of Monocle's Prism.getOption.

Mirror of Monocle's Prism.getOption.

Attributes

Source
PrismLaws.scala
def modifyIdentity(s: S): Boolean

modify(identity) == identity.

modify(identity) == identity.

Attributes

Source
PrismLaws.scala
def partialRoundTripOneWay(s: S): Boolean

Hit ⇒ reverseGet(a) == s where getOption(s) == Some(a) — rebuild restores the source.

Hit ⇒ reverseGet(a) == s where getOption(s) == Some(a) — rebuild restores the source.

Attributes

Source
PrismLaws.scala
def roundTripOtherWay(a: A): Boolean

getOption(reverseGet(a)) == Some(a) — a built value always matches.

getOption(reverseGet(a)) == Some(a) — a built value always matches.

Attributes

Source
PrismLaws.scala