schematic-0.4.2.0: JSON-biased spec and validation tool

Safe HaskellNone
LanguageHaskell2010

Data.Schematic.DSL

Documentation

type Constructor a = forall b. FSubset (FieldsOf a) b (FImage (FieldsOf a) b) => Rec (Tagged (FieldsOf a) :. FieldRepr) b -> JsonRepr (SchemaObject (FieldsOf a)) #

class Representable s where #

Minimal complete definition

constructField

Methods

constructField :: Sing fn -> Proxy s -> Repr s -> FieldRepr '(fn, s) #

Instances

Representable SchemaBoolean # 
SingI [TextConstraint] cs => Representable (SchemaText cs) # 
SingI [NumberConstraint] cs => Representable (SchemaNumber cs) # 
SingI [(Symbol, Schema)] so => Representable (SchemaObject so) # 
SingI Schema so => Representable (SchemaOptional so) # 
SingI [Schema] ((:) Schema h tl) => Representable (SchemaUnion ((:) Schema h tl)) # 

Methods

constructField :: Sing Symbol fn -> Proxy Schema (SchemaUnion ((Schema ': h) tl)) -> Repr (SchemaUnion ((Schema ': h) tl)) -> FieldRepr ((Symbol, Schema) fn (SchemaUnion ((Schema ': h) tl))) #

(SingI [ArrayConstraint] cs, SingI Schema sa) => Representable (SchemaArray cs sa) # 

Methods

constructField :: Sing Symbol fn -> Proxy Schema (SchemaArray cs sa) -> Repr (SchemaArray cs sa) -> FieldRepr ((Symbol, Schema) fn (SchemaArray cs sa)) #

construct :: Sing s -> Repr s -> JsonRepr s #

type family FieldsOf (s :: Schema) :: [(Symbol, Schema)] where ... #

Equations

FieldsOf (SchemaObject fs) = fs 

type FieldConstructor fn = forall fs. Representable (ByField fn fs (FIndex fn fs)) => Repr (ByField fn fs (FIndex fn fs)) -> (Tagged fs :. FieldRepr) '(fn, ByField fn fs (FIndex fn fs)) #

field :: forall fn. KnownSymbol fn => FieldConstructor fn #

type family Repr (s :: Schema) = (ty :: Type) where ... #