morphling
package morphling
- Alphabetic
- By Inheritance
- morphling
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- final case class Absent[O, F[_], I](fieldName: String, extract: Extract[O, Option[I]]) extends PropSchema[O, F, Option[I]] with Product with Serializable
Class describing an optional property of a record that is always absent.
Class describing an optional property of a record that is always absent.
- fieldName
The name of the property.
- extract
Extract lens from the record type to the property.
- final case class Alt[F[_], I, I0](id: String, base: F[I0], subset: Subset[I, I0]) extends Product with Serializable
A prism between a base type containing the arguments required by a single constructor of a sum type, and that sum type, along with the schema for the base type is used to describe those constructor arguments.
A prism between a base type containing the arguments required by a single constructor of a sum type, and that sum type, along with the schema for the base type is used to describe those constructor arguments. The identifier is used to distinguish which constructor is being represented in the serialized form.
- final case class Constant[O, F[_], I](fieldName: String, value: I, extract: Extract[O, I]) extends PropSchema[O, F, I] with Product with Serializable
Class describing a constant (non-serializable) property of a record.
Class describing a constant (non-serializable) property of a record.
- fieldName
The name of the property.
- value
The value of the property.
- extract
Extract lens from the record type to the property.
- sealed trait Constructors[I, F[_], H <: HList] extends AnyRef
Implicit proof type
Implicit proof type
- Annotations
- @implicitNotFound()
- type HAlgebra[F[_[_], _], G[_]] = FunctionK[[β$0$]F[G, β$0$], G]
- type HCoAlgebra[F[_[_], _], G[_]] = FunctionK[G, [β$1$]F[G, β$1$]]
- type HCofree[F[_[_], _], A[_], I] = HFix[[γ$2$[_$1], δ$3$]HEnvT[A, F, γ$2$, δ$3$], I]
- final case class HEnvT[E[_], F[_[_], _], G[_], I](ask: E[I], fa: F[G, I]) extends Product with Serializable
- final case class HFix[F[_[_], _], I](unfix: Eval[F[[β$3$]HFix[F, β$3$], I]]) extends Product with Serializable
Fixpoint data type that can preserve a type index through its recursive step.
- trait HFunctor[F[_[_], _]] extends AnyRef
- final case class HMutu[F[_[_], _], G[_[_], _], I](unmutu: F[[I]G[[I]HMutu[F, G, I], I], I]) extends Product with Serializable
- case class IsoSchema[P[_], F[_], I, J](base: F[I], eqv: Equivalent[I, J]) extends SchemaF[P, F, J] with Product with Serializable
- final case class OneOfSchema[P[_], F[_], I](alts: NonEmptyList[Alt[F, I, _]], discriminator: Option[String] = None) extends SchemaF[P, F, I] with Product with Serializable
Constructor that enables creation of schema for sum types.
Constructor that enables creation of schema for sum types.
Each constructor of the sum type
I
is represented as a member of the list of alternatives. Each alternative defines a prism between a single constructor of the sum type, and an underlying type describing the arguments demanded by that constructor.Consider the following sum type. The first constructor takes no arguments; the second takes two.
sealed trait Role case object User extends Role case class Administrator(department: String, subordinateCount: Int) extends Role
A schema value for this type looks like:
val roleSchema = oneOf( alt[Unit, Prim, Role, Unit]( "user", Schema.empty, (_: Unit) => User, { case User => Some(Unit) case _ => None } ) :: alt[Unit, Prim, Role, Administrator]( "administrator", rec[Prim, Administrator]( ( required("department", Prim.str, (_: Administrator).department), required("subordinateCount", Prim.int, (_: Administrator).subordinateCount) ).mapN(Administrator.apply) ), identity, { case a @ Administrator(_, _) => Some(a) case _ => None } ) :: Nil )
- P
The GADT type constructor for a sum type which defines the set of primitive types used in the schema.
- F
The functor through which the structure of the schema will be interpreted. This will almost always be a fixpoint type such as morphling.HFix.HCofree, which is used to introduce the ability to create recursive (tree-structured) schema.
- I
The type of the Scala value to be produced (or consumed) by an interpreter of the schema. Also known as the "index" type of the schema.
- final case class Optional[O, F[_], I](fieldName: String, base: F[I], extract: Extract[O, Option[I]]) extends PropSchema[O, F, Option[I]] with Product with Serializable
Class describing an optional property of a record.
Class describing an optional property of a record. Since in many serialized forms optional properties may be omitted entirely from the serialized form, a distinct type is needed in order to be able to correctly interpret the absence of a field.
- fieldName
The name of the property.
- base
Schema for the property's value type.
- extract
Extract lens from the record type to the property.
- final case class PrimSchema[P[_], F[_], I](prim: P[I]) extends SchemaF[P, F, I] with Product with Serializable
Schema constructor that wraps a value of an underlying GADT of allowed primitive types.
Schema constructor that wraps a value of an underlying GADT of allowed primitive types.
The underlying GADT defines a set of types via GADT constructors; see morphling.protocol.SType for an example. This set of types defines what types may be treated as primitive (and have parsing/ serialization/etc deferred to an external handler) when interpreting a schema value. For example, one might want to construct a GADT for for the Scala primitive types as such:
sealed trait SType[I] case object SNullT extends SType[Unit] case object SBoolT extends SType[Boolean] case object SByteT extends SType[Byte] case object SShortT extends SType[Short] case object SIntT extends SType[Int] case object SLongT extends SType[Long] case object SFloatT extends SType[Float] case object SDoubleT extends SType[Double] case object SCharT extends SType[Char] case object SStrT extends SType[String]
This example treats String values as primitive as well, even though strictly speaking they're reference types, just because virtually any interpreter for a schema algebra will not want to represent strings in terms of sum or product types. The same might hold true for, for example, scala.Array but for the purposes of this example issues related to
ClassManifest
instances would introduce excessive complexity.- P
The GADT type constructor for a sum type which defines the set of primitive types used in the schema.
- F
The functor through which the structure of the schema will be interpreted. This will almost always be a fixpoint type such as morphling.HFix.HCofree, which is used to introduce the ability to create recursive (tree-structured) schema.
- I
The type of the Scala value to be produced (or consumed) by an interpreter of the schema. Also known as the "index" type of the schema.
- prim
value identifying a primitive type.
- sealed trait PropSchema[O, F[_], I] extends AnyRef
Base trait for values which describe record properties.
- final case class RecordSchema[P[_], F[_], I](props: FreeApplicative[[γ$9$]PropSchema[I, F, γ$9$], I]) extends SchemaF[P, F, I] with Product with Serializable
Wrapper for the free applicative structure which is used to construct and disassemble values of product types.
Wrapper for the free applicative structure which is used to construct and disassemble values of product types.
- P
The GADT type constructor for a sum type which defines the set of primitive types used in the schema.
- F
The functor through which the structure of the schema will be interpreted. This will almost always be a fixpoint type such as morphling.HFix.HCofree, which is used to introduce the ability to create recursive (tree-structured) schema.
- I
The type of the Scala value to be produced (or consumed) by an interpreter of the schema. Also known as the "index" type of the schema.
- props
the free applicative value composed of zero or more PropSchema instances
- final case class Required[O, F[_], I](fieldName: String, base: F[I], extract: Extract[O, I], default: Option[I]) extends PropSchema[O, F, I] with Product with Serializable
Class describing a required property of a record.
Class describing a required property of a record.
- fieldName
The name of the property.
- base
Schema for the property's value type.
- extract
Extract lens from the record type to the property.
- default
Optional default value, for use in the case that a serialized form is missing the property.
- sealed trait SchemaF[P[_], F[_], I] extends AnyRef
The base trait for the schema GADT.
Value Members
- object Constructors
- object HEnvT extends Serializable
- object HFix extends Serializable
- object HFunctor
- object HMutu extends Serializable
- object PropSchema
- object Schema
Data types and smart constructors which simplify the creation of schema values.
- object SchemaF