Packages

object Translator

General functorial framework for translation.

Translators with I the input type and O the output type are primarily built from Junctions

  • a pattern which map I => Option[X[O]], with X[_] 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.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Translator
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. 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.

  2. 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.

  3. 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.

  4. 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

  5. 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.

  6. 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.

  7. 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.

  8. 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.

  9. 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

  10. 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

  1. 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)

  2. def unmatched[A](args: A*): Nothing
  3. object Pattern