Surjection

smithy4s.Surjection
See theSurjection companion object
trait Surjection[A, B] extends A => Either[String, B]

A surjection of a partial function A => Either[String, B] and a total function B => A.

A surjection MUST abide by the round-tripping property, namely, for all input A that passes the validation function

surjection(input).map(surjection.from) == Right(input)

Attributes

Companion
object
Graph
Supertypes
trait A => Either[String, B]
class Object
trait Matchable
class Any
Self type
Surjection[A, B]

Members list

Value members

Abstract methods

def from(b: B): A
def to(a: A): Either[String, B]

Concrete methods

final def apply(a: A): Either[String, B]
final def imapFull[A0, B0](sourceBijection: Bijection[A, A0], targetBijection: Bijection[B, B0]): Surjection[A0, B0]
final def imapSource[A0](bijection: Bijection[A, A0]): Surjection[A0, B]
final def imapTarget[B0](bijection: Bijection[B, B0]): Surjection[A, B0]

Inherited methods

def andThen[A](g: Either[String, B] => A): T1 => A

Attributes

Inherited from:
Function1
def compose[A](g: A => A): A => R

Attributes

Inherited from:
Function1
override def toString(): String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Function1 -> Any
Inherited from:
Function1