Interface Prism.Simple<S,A>

Type Parameters:
S - the input that might fail to map to its output and the guaranteed output from the other direction
A - the output that might fail to be produced and the input that guarantees its output in the other direction
All Superinterfaces:
Applicative<S,Prism<S,?,A,A>>, Contravariant<S,Profunctor<?,S,Prism<?,?,A,A>>>, Functor<S,Prism<S,?,A,A>>, Monad<S,Prism<S,?,A,A>>, MonadRec<S,Prism<S,?,A,A>>, Optic<Cocartesian<?,?,?>,Identity<?>,S,S,A,A>, Prism<S,S,A,A>, Profunctor<S,S,Prism<?,?,A,A>>, ProtoOptic<Cocartesian<?,?,?>,S,S,A,A>
Enclosing interface:
Prism<S,T,A,B>

public static interface Prism.Simple<S,A> extends Prism<S,S,A,A>
A convenience type with a simplified type signature for common prism with unified S/T and A/B types.
  • Method Details

    • adapt

      static <S, A> Prism.Simple<S,A> adapt(Prism<S,S,A,A> prism)
      Adapt a Prism with compatible bounds to a simple Prism.
      Type Parameters:
      S - the input that might fail to map to its output and the guaranteed output from the other direction
      A - the output that might fail to be produced and the input that guarantees its output in the other direction
      Parameters:
      prism - the Prism
      Returns:
      the simple Prism
    • adapt

      static <S, A> Prism.Simple<S,A> adapt(ProtoOptic<? super Cocartesian<?,?,?>,S,S,A,A> protoOptic)
      Adapt a ProtoOptic with compatible bounds to a simple Prism.
      Type Parameters:
      S - the input that might fail to map to its output and the guaranteed output from the other direction
      A - the output that might fail to be produced and the input that guarantees its output in the other direction
      Parameters:
      protoOptic - the ProtoOptic
      Returns:
      the simple Prism
    • adapt

      static <S, A> Prism.Simple<S,A> adapt(Optic<? super Cocartesian<?,?,?>,? super Functor<?,?>,S,S,A,A> optic)
      Adapt an Optic with compatible bounds to a simple Prism.
      Type Parameters:
      S - the input that might fail to map to its output and the guaranteed output from the other direction
      A - the output that might fail to be produced and the input that guarantees its output in the other direction
      Parameters:
      optic - the Optic
      Returns:
      the simple Prism
    • fromPartial

      static <S, A> Prism.Simple<S,A> fromPartial(Fn1<? super S,? extends A> partialSa, Fn1<? super A,? extends S> as)
      Static factory method for creating a simple Prism from a partial function S -> A and a total function A -> T.
      Type Parameters:
      S - the input that might fail to map to its output and the guaranteed output from the other direction
      A - the output that might fail to be produced and the input that guarantees its output in the other direction
      Parameters:
      partialSa - the partial direction
      as - the reverse total direction
      Returns:
      the simple Prism