abstract class PPrism[S, T, A, B] extends Serializable
A PPrism can be seen as a pair of functions:
getOrModify: S => T \/ A
reverseGet : B => T
A PPrism could also be defined as a weaker PIso where get can fail.
Typically a PPrism or Prism encodes the relation between a Sum or CoProduct type (e.g. sealed trait) and one of its element.
PPrism stands for Polymorphic Prism as it set and modify methods change
a type A
to B
and S
to T
.
Prism is a type alias for PPrism where the type of target cannot be modified:
type Prism[S, A] = PPrism[S, S, A, A]
A PPrism is also a valid Fold, POptional, PTraversal and PSetter
- S
the source of a PPrism
- T
the modified source of a PPrism
- A
the target of a PPrism
- B
the modified target of a PPrism
- Self Type
- PPrism[S, T, A, B]
- See also
- Alphabetic
- By Inheritance
- PPrism
- Serializable
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new PPrism()
Abstract Value Members
-
abstract
def
getOption(s: S): Option[A]
get the target of a PPrism or nothing if there is no target
-
abstract
def
getOrModify(s: S): \/[T, A]
get the target of a PPrism or return the original value while allowing the type to change if it does not match
-
abstract
def
reverseGet(b: B): T
get the modified source of a PPrism
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
^<->[C, D](other: PIso[A, B, C, D]): PPrism[S, T, C, D]
alias to composeIso
alias to composeIso
- Annotations
- @inline()
-
final
def
^<-?[C, D](other: PPrism[A, B, C, D]): PPrism[S, T, C, D]
alias to composePrism
alias to composePrism
- Annotations
- @inline()
-
final
def
^|->[C, D](other: PLens[A, B, C, D]): POptional[S, T, C, D]
alias to composeLens
alias to composeLens
- Annotations
- @inline()
-
final
def
^|->>[C, D](other: PTraversal[A, B, C, D]): PTraversal[S, T, C, D]
alias to composeTraversal
alias to composeTraversal
- Annotations
- @inline()
-
final
def
^|-?[C, D](other: POptional[A, B, C, D]): POptional[S, T, C, D]
alias to composeOptional
alias to composeOptional
- Annotations
- @inline()
-
final
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
- Annotations
- @inline()
- def apply[C, D, E, F, G, H](c: C, d: D, e: E, f: F, g: G, h: H)(implicit ev: <~<[(C, D, E, F, G, H), B]): T
- def apply[C, D, E, F, G](c: C, d: D, e: E, f: F, g: G)(implicit ev: <~<[(C, D, E, F, G), B]): T
- def apply[C, D, E, F](c: C, d: D, e: E, f: F)(implicit ev: <~<[(C, D, E, F), B]): T
- def apply[C, D, E](c: C, d: D, e: E)(implicit ev: <~<[(C, D, E), B]): T
- def apply[C, D](c: C, d: D)(implicit ev: <~<[(C, D), B]): T
- def apply(b: B): T
-
def
apply()(implicit ev: ===[B, Unit]): T
**********************************************************************
- final def asFold: Fold[S, A]
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
- final def asOptional: POptional[S, T, A, B]
- final def asSetter: PSetter[S, T, A, B]
-
final
def
asTraversal: PTraversal[S, T, A, B]
view a PPrism as a PTraversal
view a PPrism as a PTraversal
- Annotations
- @inline()
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
- final def composeFold[C](other: Fold[A, C]): Fold[S, C]
- final def composeGetter[C](other: Getter[A, C]): Fold[S, C]
- final def composeIso[C, D](other: PIso[A, B, C, D]): PPrism[S, T, C, D]
- final def composeLens[C, D](other: PLens[A, B, C, D]): POptional[S, T, C, D]
- final def composeOptional[C, D](other: POptional[A, B, C, D]): POptional[S, T, C, D]
- final def composePrism[C, D](other: PPrism[A, B, C, D]): PPrism[S, T, C, D]
- final def composeSetter[C, D](other: PSetter[A, B, C, D]): PSetter[S, T, C, D]
-
final
def
composeTraversal[C, D](other: PTraversal[A, B, C, D]): PTraversal[S, T, C, D]
compose a PPrism with a PTraversal
compose a PPrism with a PTraversal
- Annotations
- @inline()
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
exist(p: (A) ⇒ Boolean): (S) ⇒ Boolean
check if there is a target and it satisfies the predicate
check if there is a target and it satisfies the predicate
- Annotations
- @inline()
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
find(p: (A) ⇒ Boolean): (S) ⇒ Option[A]
find if the target satisfies the predicate
find if the target satisfies the predicate
- Annotations
- @inline()
-
final
def
first[C]: PPrism[(S, C), (T, C), (A, C), (B, C)]
- Annotations
- @inline()
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isEmpty(s: S): Boolean
check if there is no target
check if there is no target
- Annotations
- @inline()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
left[C]: PPrism[\/[S, C], \/[T, C], \/[A, C], \/[B, C]]
- Annotations
- @inline()
-
final
def
modify(f: (A) ⇒ B): (S) ⇒ T
modify polymorphically the target of a PPrism with a function
modify polymorphically the target of a PPrism with a function
- Annotations
- @inline()
-
final
def
modifyF[F[_]](f: (A) ⇒ F[B])(s: S)(implicit arg0: Applicative[F]): F[T]
modify polymorphically the target of a PPrism with an Applicative function
modify polymorphically the target of a PPrism with an Applicative function
- Annotations
- @inline()
-
final
def
modifyOption(f: (A) ⇒ B): (S) ⇒ Option[T]
modify polymorphically the target of a PPrism with a function.
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
nonEmpty(s: S): Boolean
check if there is a target
check if there is a target
- Annotations
- @inline()
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
re: Getter[B, T]
create a Getter from the modified target to the modified source of a PPrism
-
final
def
right[C]: PPrism[\/[C, S], \/[C, T], \/[C, A], \/[C, B]]
- Annotations
- @inline()
-
final
def
second[C]: PPrism[(C, S), (C, T), (C, A), (C, B)]
- Annotations
- @inline()
-
final
def
set(b: B): (S) ⇒ T
set polymorphically the target of a PPrism with a value
set polymorphically the target of a PPrism with a value
- Annotations
- @inline()
-
final
def
setOption(b: B): (S) ⇒ Option[T]
set polymorphically the target of a PPrism with a value.
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
- def unapply(obj: S): Option[A]
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()