com.eharmony.aloha.semantics

MorphableSemantics

trait MorphableSemantics[M[_] <: Semantics[_], A] extends Semantics[A]

A version of Semantics that can morph into other instances of the same structure but with a different type parameter.

An example:

case class X[A]() extends MorphableSemantics[X, A] {
// ...
def morph[B: RefInfo]: Option[X[B]] = Some(X[B]())
}

Notice for class X, that the M type constructor is X and the A is the same for the second type parameter of MorphableSemantics as for the type parameter in Semantics.

This can be use like the following:

import com.eharmony.aloha.reflect.RefInfo

val xF = X[Float]
val riD = implicitly[RefInfo[Double]]
val xDo: Option[X[Double]] = xF.morph[Double]
val xDo1: Option[X[Double]] = xF.morph(riD)

or use it generically:

def morph[M[_] <: Semantics[_], A, B: RefInfo](m: MorphableSemantics[M, A]): Option[Semantics[B]] = {
  m.morph[B]
}

val sDO: Option[Semantics[Double]] = morph(xF)
M

a type constructor providing the structure of the Semantics. This will most likely always be the concrete subclass of Semantics that implements MorphableSemantics.

A

the type parameter to which M is applied for this instance of Semantics, also the type parameter for the Semantics.

Linear Supertypes
Semantics[A], Closeable, AutoCloseable, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. MorphableSemantics
  2. Semantics
  3. Closeable
  4. AutoCloseable
  5. AnyRef
  6. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def accessorFunctionNames: Seq[String]

    Returns the string representations of all of the data "variables" used by functions created from this Semantics object.

    Returns the string representations of all of the data "variables" used by functions created from this Semantics object.

    returns

    Definition Classes
    Semantics
  2. abstract def close(): Unit

    Definition Classes
    Closeable → AutoCloseable
    Annotations
    @throws( classOf[java.io.IOException] )
  3. abstract def createFunction[B](codeSpec: String, default: Option[B] = None)(implicit arg0: RefInfo[B]): Either[Seq[String], GenAggFunc[A, B]]

    Create a function from A to B.

    Create a function from A to B.

    B

    The return type of the function.

    codeSpec

    specification for a function to be produced by this semantics.

    default

    a default value in the case that the function would produce an optional type.

    returns

    Definition Classes
    Semantics
  4. abstract def morph[B](implicit ri: RefInfo[B]): Option[MorphableSemantics[M, B]]

    Attempt to morph this MorphableSemantics into a new one with the same structure.

    Attempt to morph this MorphableSemantics into a new one with the same structure.

    The new MorphableSemantics will have the same structure (as dictated by the M type parameter) but with a different second parameter. This new instance must also be a Semantics[B]. It can be the case that a specific implementation of MorphableSemantics doesn't allow for all B, in which case a None can be returned.

    B

    input type for the new MorphableSemantics instance that might be created. A MorphableSemantics instance may choose not allow morphing to all B. In that case, a None will be returned.

    ri

    reflection information that may be necessary to determine whether to create the MorphableSemantics that was requested.

    returns

  5. abstract def refInfoA: RefInfo[A]

    returns

    a com.eharmony.aloha.reflect.RefInfo for input type A.

    Definition Classes
    Semantics

Concrete Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  9. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  10. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  11. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  12. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  13. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  14. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  15. final def notify(): Unit

    Definition Classes
    AnyRef
  16. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  17. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  18. def toString(): String

    Definition Classes
    AnyRef → Any
  19. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  20. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  21. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Semantics[A]

Inherited from Closeable

Inherited from AutoCloseable

Inherited from AnyRef

Inherited from Any

Ungrouped