morphling
Members list
Packages
Type members
Classlikes
Class describing an optional property of a record that is always absent.
Class describing an optional property of a record that is always absent.
Value parameters
- extract
-
Extract lens from the record type to the property.
- fieldName
-
The name of the property.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
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.
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.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Class describing a constant (non-serializable) property of a record.
Class describing a constant (non-serializable) property of a record.
Value parameters
- extract
-
Extract lens from the record type to the property.
- fieldName
-
The name of the property.
- value
-
The value of the property.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Fixpoint data type that can preserve a type index through its recursive step.
Fixpoint data type that can preserve a type index through its recursive step.
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
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
)
Type parameters
- F
-
$FDefn
- I
-
$IDefn
- P
-
$PDefn
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
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.
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.
Value parameters
- base
-
Schema for the property's value type.
- extract
-
Extract lens from the record type to the property.
- fieldName
-
The name of the property.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
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.
Type parameters
- F
-
$FDefn
- I
-
$IDefn
- P
-
$PDefn
Value parameters
- prim
-
value identifying a primitive type.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- trait
- Supertypes
-
trait Sumtrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
PropSchema.type
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.
Type parameters
- F
-
$FDefn
- I
-
$IDefn
- P
-
$PDefn
Value parameters
- props
-
the free applicative value composed of zero or more PropSchema instances
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Class describing a required property of a record.
Class describing a required property of a record.
Value parameters
- base
-
Schema for the property's value type.
- default
-
Optional default value, for use in the case that a serialized form is missing the property.
- extract
-
Extract lens from the record type to the property.
- fieldName
-
The name of the property.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Data types and smart constructors which simplify the creation of schema values.
Data types and smart constructors which simplify the creation of schema values.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Schema.type
The base trait for the schema GADT.
The base trait for the schema GADT.
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-