PrimSchema
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
- Graph
-
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass Any