PIso

monocle.PIso
See thePIso companion object
trait PIso[S, T, A, B] extends PLens[S, T, A, B] with PPrism[S, T, A, B]

Iso is a type alias for PIso where S = A and T = B:

type Iso[S, A] = PIso[S, S, A, A]

An Iso defines an isomorphism between a type S and A:

 get
--------------------> S A <-------------------- reverseGet 

A PIso allows to lift a function f: A => B to S => T and a function g: T => S to B => A

 g S T S
<-------- T
| ↑ | ↑
| | | | get | | reverseGet reverse.reverseGet | | reverse.get
| | | | ↓ f | ↓ | A --------> B A B 

A PIso is also a valid Getter, Fold, PLens, PPrism, POptional, PTraversal and PSetter

Attributes

A

the target of a PIso

B

the modified target of a PIso

S

the source of a PIso

T

the modified source of a PIso

See also:
Companion:
object
Source:
Iso.scala
Graph
Supertypes
trait PPrism[S, T, A, B]
trait PLens[S, T, A, B]
trait Getter[S, A]
trait POptional[S, T, A, B]
trait PTraversal[S, T, A, B]
trait Fold[S, A]
trait PSetter[S, T, A, B]
trait Serializable
class Object
trait Matchable
class Any
Self type
PIso[S, T, A, B]

Members list

Concise view

Value members

Abstract methods

def reverse: PIso[B, A, T, S]

reverse a PIso: the source becomes the target and the target becomes the source

reverse a PIso: the source becomes the target and the target becomes the source

Attributes

Source:
Iso.scala

Concrete methods

def andThen[C, D](other: PIso[A, B, C, D]): PIso[S, T, C, D]

compose a PIso with another PIso

compose a PIso with another PIso

Attributes

Source:
Iso.scala
override def apply()(implicit ev: Is[B, Unit]): T

Attributes

Definition Classes
Source:
Iso.scala
override def apply(b: B): T

Attributes

Definition Classes
Source:
Iso.scala
override def apply[C, D](c: C, d: D)(implicit ev: As[(C, D), B]): T

Attributes

Definition Classes
Source:
Iso.scala
override def apply[C, D, E](c: C, d: D, e: E)(implicit ev: As[(C, D, E), B]): T

Attributes

Definition Classes
Source:
Iso.scala
override def apply[C, D, E, F](c: C, d: D, e: E, f: F)(implicit ev: As[(C, D, E, F), B]): T

Attributes

Definition Classes
Source:
Iso.scala
override def apply[C, D, E, F, G](c: C, d: D, e: E, f: F, g: G)(implicit ev: As[(C, D, E, F, G), B]): T

Attributes

Definition Classes
Source:
Iso.scala
override def apply[C, D, E, F, G, H](c: C, d: D, e: E, f: F, g: G, h: H)(implicit ev: As[(C, D, E, F, G, H), B]): T

Attributes

Definition Classes
Source:
Iso.scala
override def asFold: Fold[S, A]

view a PIso as a Fold

view a PIso as a Fold

Attributes

Definition Classes
Source:
Iso.scala
def asLens: PLens[S, T, A, B]

view a PIso as a PLens

view a PIso as a PLens

Attributes

Source:
Iso.scala
override def asOptional: POptional[S, T, A, B]

view a PIso as a POptional

view a PIso as a POptional

Attributes

Definition Classes
Source:
Iso.scala
def asPrism: PPrism[S, T, A, B]

view a PIso as a PPrism

view a PIso as a PPrism

Attributes

Source:
Iso.scala
override def asSetter: PSetter[S, T, A, B]

view a PIso as a Setter

view a PIso as a Setter

Attributes

Definition Classes
Source:
Iso.scala
override def asTraversal: PTraversal[S, T, A, B]

view a PIso as a PTraversal

view a PIso as a PTraversal

Attributes

Definition Classes
Source:
Iso.scala
override def exist(p: A => Boolean): S => Boolean

check if the target satisfies the predicate

check if the target satisfies the predicate

Attributes

Definition Classes
Source:
Iso.scala
override def find(p: A => Boolean): S => Option[A]

find if the target satisfies the predicate

find if the target satisfies the predicate

Attributes

Definition Classes
Source:
Iso.scala
override def foldMap[M : Monoid](f: A => M)(s: S): M

map each target to a Monoid and combine the results underlying representation of Fold, all Fold methods are defined in terms of foldMap

map each target to a Monoid and combine the results underlying representation of Fold, all Fold methods are defined in terms of foldMap

Attributes

Definition Classes
Source:
Iso.scala
override def index[I, A1](i: I)(implicit evIndex: Index[A, I, A1], evMonoS: S =:= T, evMonoA: A =:= B): Optional[S, A1]

Attributes

Definition Classes
Source:
Iso.scala
def mapping[F[_] : Functor]: PIso[F[S], F[T], F[A], F[B]]

lift a PIso to a Functor level

lift a PIso to a Functor level

Attributes

Source:
Iso.scala
override def modify(f: A => B): S => T

modify polymorphically the target of a PIso with a function

modify polymorphically the target of a PIso with a function

Attributes

Definition Classes
Source:
Iso.scala
override def modifyA[F[_] : Applicative](f: A => F[B])(s: S): F[T]

modify polymorphically the target of a PPrism with an Applicative function

modify polymorphically the target of a PPrism with an Applicative function

Attributes

Definition Classes
Source:
Iso.scala
override def modifyF[F[_] : Functor](f: A => F[B])(s: S): F[T]

modify polymorphically the target of a PIso with a Functor function

modify polymorphically the target of a PIso with a Functor function

Attributes

Definition Classes
Source:
Iso.scala
override def replace(b: B): S => T

replace polymorphically the target of a PIso with a value

replace polymorphically the target of a PIso with a value

Attributes

Definition Classes
Source:
Iso.scala
override def some[A1, B1](implicit ev1: A =:= Option[A1], ev2: B =:= Option[B1]): PPrism[S, T, A1, B1]

Attributes

Definition Classes
Source:
Iso.scala
override def to[C](f: A => C): Getter[S, C]

Compose with a function lifted into a Getter

Compose with a function lifted into a Getter

Attributes

Definition Classes
Source:
Iso.scala
override def unapply(obj: S): Some[A]

Attributes

Definition Classes
Source:
Iso.scala

Deprecated methods

def ^<->[C, D](other: PIso[A, B, C, D]): PIso[S, T, C, D]
Implicitly added by pIsoSyntax

alias to composeIso

alias to composeIso

Attributes

Deprecated
[Since version 3.0.0-M1]
Source:
Iso.scala
def ^<-?[C, D](other: PPrism[A, B, C, D]): PPrism[S, T, C, D]
Implicitly added by pIsoSyntax

alias to composePrism

alias to composePrism

Attributes

Deprecated
[Since version 3.0.0-M1]
Source:
Iso.scala
def ^|->[C, D](other: PLens[A, B, C, D]): PLens[S, T, C, D]
Implicitly added by pIsoSyntax

alias to composeLens

alias to composeLens

Attributes

Deprecated
[Since version 3.0.0-M1]
Source:
Iso.scala
def ^|->>[C, D](other: PTraversal[A, B, C, D]): PTraversal[S, T, C, D]
Implicitly added by pIsoSyntax

alias to composeTraversal

alias to composeTraversal

Attributes

Deprecated
[Since version 3.0.0-M1]
Source:
Iso.scala
def ^|-?[C, D](other: POptional[A, B, C, D]): POptional[S, T, C, D]
Implicitly added by pIsoSyntax

alias to composeOptional

alias to composeOptional

Attributes

Deprecated
[Since version 3.0.0-M1]
Source:
Iso.scala
def composeFold[C](other: Fold[A, C]): Fold[S, C]
Implicitly added by pIsoSyntax

compose a PIso with a Fold

compose a PIso with a Fold

Attributes

Deprecated
[Since version 3.0.0-M1]
Source:
Iso.scala
def composeGetter[C](other: Getter[A, C]): Getter[S, C]
Implicitly added by pIsoSyntax

compose a PIso with a Getter

compose a PIso with a Getter

Attributes

Deprecated
[Since version 3.0.0-M1]
Source:
Iso.scala
def composeIso[C, D](other: PIso[A, B, C, D]): PIso[S, T, C, D]
Implicitly added by pIsoSyntax

compose a PIso with a PIso

compose a PIso with a PIso

Attributes

Deprecated
[Since version 3.0.0-M1]
Source:
Iso.scala
def composeLens[C, D](other: PLens[A, B, C, D]): PLens[S, T, C, D]
Implicitly added by pIsoSyntax

compose a PIso with a PLens

compose a PIso with a PLens

Attributes

Deprecated
[Since version 3.0.0-M1]
Source:
Iso.scala
def composeOptional[C, D](other: POptional[A, B, C, D]): POptional[S, T, C, D]
Implicitly added by pIsoSyntax

compose a PIso with a POptional

compose a PIso with a POptional

Attributes

Deprecated
[Since version 3.0.0-M1]
Source:
Iso.scala
def composePrism[C, D](other: PPrism[A, B, C, D]): PPrism[S, T, C, D]
Implicitly added by pIsoSyntax

compose a PIso with a PPrism

compose a PIso with a PPrism

Attributes

Deprecated
[Since version 3.0.0-M1]
Source:
Iso.scala
def composeSetter[C, D](other: PSetter[A, B, C, D]): PSetter[S, T, C, D]
Implicitly added by pIsoSyntax

compose a PIso with a PSetter

compose a PIso with a PSetter

Attributes

Deprecated
[Since version 3.0.0-M1]
Source:
Iso.scala
def composeTraversal[C, D](other: PTraversal[A, B, C, D]): PTraversal[S, T, C, D]
Implicitly added by pIsoSyntax

compose a PIso with a PTraversal

compose a PIso with a PTraversal

Attributes

Deprecated
[Since version 3.0.0-M1]
Source:
Iso.scala
override def first[C]: PIso[(S, C), (T, C), (A, C), (B, C)]

Attributes

Deprecated
[Since version 3.0.0-M4]
Definition Classes
Source:
Iso.scala
override def left[C]: PIso[Either[S, C], Either[T, C], Either[A, C], Either[B, C]]

Attributes

Deprecated
[Since version 3.0.0-M4]
Definition Classes
Source:
Iso.scala
override def right[C]: PIso[Either[C, S], Either[C, T], Either[C, A], Either[C, B]]

Attributes

Deprecated
[Since version 3.0.0-M4]
Definition Classes
Source:
Iso.scala
override def second[C]: PIso[(C, S), (C, T), (C, A), (C, B)]

Attributes

Deprecated
[Since version 3.0.0-M4]
Definition Classes
Source:
Iso.scala
def split[S1, T1, A1, B1](other: PIso[S1, T1, A1, B1]): PIso[(S, S1), (T, T1), (A, A1), (B, B1)]

pair two disjoint PIso

pair two disjoint PIso

Attributes

Deprecated
[Since version 3.0.0-M4]
Source:
Iso.scala

Inherited methods

override def all(p: A => Boolean): S => Boolean

check if there is no target or the target satisfies the predicate

check if there is no target or the target satisfies the predicate

Attributes

Definition Classes
Inherited from:
POptional
Source:
Optional.scala
def andThen[C, D](other: PPrism[A, B, C, D]): PPrism[S, T, C, D]

compose a PPrism with another PPrism

compose a PPrism with another PPrism

Attributes

Inherited from:
PPrism
Source:
Prism.scala
def andThen[C, D](other: POptional[A, B, C, D]): POptional[S, T, C, D]

compose a POptional with a POptional

compose a POptional with a POptional

Attributes

Inherited from:
POptional
Source:
Optional.scala
def andThen[C, D](other: PTraversal[A, B, C, D]): PTraversal[S, T, C, D]

compose a PTraversal with another PTraversal

compose a PTraversal with another PTraversal

Attributes

Inherited from:
PTraversal
Source:
Traversal.scala
def andThen[B](other: Fold[A, B]): Fold[S, B]

compose a Fold with another Fold

compose a Fold with another Fold

Attributes

Inherited from:
Fold
Source:
Fold.scala
def andThen[C, D](other: PSetter[A, B, C, D]): PSetter[S, T, C, D]

compose a PSetter with another PSetter

compose a PSetter with another PSetter

Attributes

Inherited from:
PSetter
Source:
Setter.scala
def andThen[C, D](other: PLens[A, B, C, D]): PLens[S, T, C, D]

compose a PLens with a PLens

compose a PLens with a PLens

Attributes

Inherited from:
PLens
Source:
Lens.scala
def andThen[B](other: Getter[A, B]): Getter[S, B]

compose a Getter with a Getter

compose a Getter with a Getter

Attributes

Inherited from:
Getter
Source:
Getter.scala
def asGetter: Getter[S, A]

view a PLens as a Getter

view a PLens as a Getter

Attributes

Inherited from:
PLens
Source:
Lens.scala
def choice[S1](other: Getter[S1, A]): Getter[Either[S, S1], A]

join two Getter with the same target

join two Getter with the same target

Attributes

Inherited from:
Getter
Source:
Getter.scala
def fold(s: S)(implicit ev: Monoid[A]): A

combine all targets using a target's Monoid

combine all targets using a target's Monoid

Attributes

Inherited from:
Fold
Source:
Fold.scala
def get(s: S): A

get the target of a PLens

get the target of a PLens

Attributes

Inherited from:
PLens
Source:
Lens.scala
def getAll(s: S): List[A]

get all the targets of a Fold

get all the targets of a Fold

Attributes

Inherited from:
Fold
Source:
Fold.scala
def getOption(s: S): Option[A]

get the target of a POptional or nothing if there is no target

get the target of a POptional or nothing if there is no target

Attributes

Inherited from:
PLens
Source:
Lens.scala
def getOrModify(s: S): Either[T, A]

get the target of a POptional or return the original value while allowing the type to change if it does not match

get the target of a POptional or return the original value while allowing the type to change if it does not match

Attributes

Inherited from:
PLens
Source:
Lens.scala
def headOption(s: S): Option[A]

get the first target

get the first target

Attributes

Inherited from:
Fold
Source:
Fold.scala
override def index[I, A1](i: I)(implicit evIndex: Index[A, I, A1]): Fold[S, A1]

Attributes

Definition Classes
Inherited from:
Getter
Source:
Getter.scala
override def isEmpty(s: S): Boolean

check if there is no target

check if there is no target

Attributes

Definition Classes
Inherited from:
POptional
Source:
Optional.scala
def lastOption(s: S): Option[A]

get the last target

get the last target

Attributes

Inherited from:
Fold
Source:
Fold.scala
def length(s: S): Int

calculate the number of targets

calculate the number of targets

Attributes

Inherited from:
Fold
Source:
Fold.scala
def modifyOption(f: A => B): S => Option[T]

modify polymorphically the target of a POptional with a function. return empty if the POptional is not matching

modify polymorphically the target of a POptional with a function. return empty if the POptional is not matching

Attributes

Inherited from:
POptional
Source:
Optional.scala
override def nonEmpty(s: S): Boolean

check if there is a target

check if there is a target

Attributes

Definition Classes
Inherited from:
POptional
Source:
Optional.scala
def orElse(other: POptional[S, T, A, B]): POptional[S, T, A, B]

fall-back to another POptional in case this one doesn't match

fall-back to another POptional in case this one doesn't match

Attributes

Inherited from:
POptional
Source:
Optional.scala
def parModifyF[F[_]](f: A => F[B])(s: S)(implicit F: Parallel[F]): F[T]

PTraversal.modifyA for a Parallel applicative functor.

PTraversal.modifyA for a Parallel applicative functor.

Attributes

Inherited from:
PTraversal
Source:
Traversal.scala
Implicitly added by pIsoSyntax

Attributes

Inherited from:
Product
Implicitly added by pIsoSyntax

Attributes

Inherited from:
Product
def re: Getter[B, T]

create a Getter from the modified target to the modified source of a PPrism

create a Getter from the modified target to the modified source of a PPrism

Attributes

Inherited from:
PPrism
Source:
Prism.scala
def replaceOption(b: B): S => Option[T]

replace polymorphically the target of a POptional with a value. return empty if the POptional is not matching

replace polymorphically the target of a POptional with a value. return empty if the POptional is not matching

Attributes

Inherited from:
POptional
Source:
Optional.scala
def reverseGet(b: B): T

get the modified source of a PPrism

get the modified source of a PPrism

Attributes

Inherited from:
PPrism
Source:
Prism.scala
override def some[A1](implicit ev1: A =:= Option[A1]): Fold[S, A1]

Attributes

Definition Classes
Inherited from:
Getter
Source:
Getter.scala
def split[S1, A1](other: Getter[S1, A1]): Getter[(S, S1), (A, A1)]

pair two disjoint Getter

pair two disjoint Getter

Attributes

Inherited from:
Getter
Source:
Getter.scala
def zip[A1](other: Getter[S, A1]): Getter[S, (A, A1)]

Attributes

Inherited from:
Getter
Source:
Getter.scala

Deprecated and Inherited methods

def set(b: B): S => T

alias to replace

alias to replace

Attributes

Deprecated
[Since version 3.0.0-M1]
Inherited from:
PSetter
Source:
Setter.scala
def setOption(b: B): S => Option[T]

alias to replaceOption

alias to replaceOption

Attributes

Deprecated
[Since version 3.0.0-M1]
Inherited from:
POptional
Source:
Optional.scala
def split[S1, T1, A1, B1](other: PLens[S1, T1, A1, B1]): PLens[(S, S1), (T, T1), (A, A1), (B, B1)]

pair two disjoint PLens

pair two disjoint PLens

Attributes

Deprecated
[Since version 3.0.0-M4]
Inherited from:
PLens
Source:
Lens.scala