object Translator
General functorial framework for translation.
Translators with I
the input type and O
the output type are primarily built from Junctions
- a
which mappattern
I => Option[X[O]]
, withX[_]
a functor with traverse, e.g. a tuple or a vector. - a
builder
O => Option[I]
to avoid having to specify types too many types, traits Pattern and Builder are defined.
We also have simpler translators for literals and also wrapping translators for a component type.
- Alphabetic
- By Inheritance
- Translator
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- case class Builder[O, X[_]](build: (X[O]) => Option[O])(implicit evidence$4: Traverse[X]) extends Product with Serializable
The building part of a junction, pattern matching and splitting to a given shape.
The building part of a junction, pattern matching and splitting to a given shape. Crucially, the shape X[_] is determined, so junctions can be built from this, after possibly mapping.
- case class Empty[I, O]() extends Translator[I, O] with Product with Serializable
empty translator, matching nothing; only information is the type parameters, so may be good starting point.
- case class Junction[I, O, X[_]](split: (I) => Option[X[I]], build: (X[O]) => Option[O])(implicit evidence$1: Traverse[X]) extends Translator[I, O] with Product with Serializable
A junction given by splitting optionally to a given shape, and building from the same shape.
A junction given by splitting optionally to a given shape, and building from the same shape.
The shape is functorial, typically made of tuples and lists, and Option gives a natural transformation. These allow applying the recursive translator on the components.
- case class Mapped[I, O, X](trans: Translator[I, O], fn: (O) => X, ufn: (X) => O) extends Translator[I, X] with Product with Serializable
mapped translator
- case class MixedJunction[I, O, X[_]](split: (I) => Option[X[I]], build: (X[I], X[O]) => Option[O])(implicit evidence$2: Traverse[X]) extends Translator[I, O] with Product with Serializable
A mixed junction given by splitting optionally to a given shape, and building from the same shape using both the input and its traslation.
A mixed junction given by splitting optionally to a given shape, and building from the same shape using both the input and its traslation.
The shape is functorial, typically made of tuples and lists, and Option gives a natural transformation. These allow applying the recursive translator on the components.
- case class OrElse[I, O](first: Translator[I, O], second: Translator[I, O]) extends Translator[I, O] with Product with Serializable
Tries the first translator at top level, then the second.
Tries the first translator at top level, then the second. Is recursive.
- class Pattern[I, X[_]] extends AnyRef
The splitting part of a junction, pattern matching and splitting to a given shape.
The splitting part of a junction, pattern matching and splitting to a given shape. Crucially, the shape X[_] is determined, so junctions can be built from this, after possibly mapping.
- case class PolyJunction[I, O, X[_]](polySplit: (I) => Option[Vector[X[I]]], build: (X[O]) => Option[O])(implicit evidence$3: Traverse[X]) extends Translator[I, O] with Product with Serializable
like a Junction but tries several cases.
- case class Simple[I, O](translate: (I) => Option[O]) extends Translator[I, O] with Product with Serializable
non-recursive translation determined by a given optional function
- case class VarWord[X[_], S](word: X[S])(implicit evidence$16: Traverse[X]) extends Product with Serializable
A word fixing the shape of patterns to which we match.
A word fixing the shape of patterns to which we match. Should work fine for tuples, but problematic with Lists returned.
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 asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- def connect[I, O, S](pattern: (I) => Option[S], literal: (S) => Option[O]): Simple[I, O]
non-recursive translation by combining a matching pattern with a simple builder (usually a literal)
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- def unmatched[A](args: A*): Nothing
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- object Pattern
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated