@@ -7,14 +7,9 @@
8module Data.Schematic.Schema where
8module Data.Schematic.Schema where
10−import Data.Functor.Foldable
11import Data.Kind hiding (Type)
10import Data.Kind hiding (Type)
12import Data.Proxy
11import Data.Proxy
13−import Data.Singletons.TH
14import Data.Text (Text)
12import Data.Text (Text)
15−import Data.Type.Equality
17−import Data.Vinyl.Functor
18import GHC.TypeLits (KnownNat, natVal, KnownSymbol, symbolVal, Symbol, Nat)
13import GHC.TypeLits (KnownNat, natVal, KnownSymbol, symbolVal, Symbol, Nat)
@@ -133,18 +128,12 @@ instance (Verifiable 'JText cs) => Schematic (SText cs) where
133 type JT (SText cs) = 'JText
128 type JT (SText cs) = 'JText
134 build _ = constructor (Proxy @(JT (SText cs))) $ schema (Proxy @JText) (Proxy @cs)
129 build _ = constructor (Proxy @(JT (SText cs))) $ schema (Proxy @JText) (Proxy @cs)
137−type TextSchema = SText '[LengthEqNat 3]
139data SNumber cs
131data SNumber cs
141instance (Verifiable 'JNumber cs) => Schematic (SNumber cs) where
133instance (Verifiable 'JNumber cs) => Schematic (SNumber cs) where
142 type JT (SNumber cs) = 'JNumber
134 type JT (SNumber cs) = 'JNumber
143 build _ = constructor (Proxy @(JT (SNumber cs))) $ schema (Proxy @'JNumber) (Proxy @cs)
135 build _ = constructor (Proxy @(JT (SNumber cs))) $ schema (Proxy @'JNumber) (Proxy @cs)
146−type NumberSchema = SNumber '[ Gt 3]
148instance (Verifiable (JT ty) cs, SchemaConstructor (JT ty)) => Schematic (Field field ty cs) where
137instance (Verifiable (JT ty) cs, SchemaConstructor (JT ty)) => Schematic (Field field ty cs) where
149 type JT (Field field ty cs) = JT ty
138 type JT (Field field ty cs) = JT ty
150 build _ = constructor (Proxy @(JT (Field field ty cs)))
139 build _ = constructor (Proxy @(JT (Field field ty cs)))
@@ -170,5 +159,3 @@ instance Schematic (SObject els) => TopLevel (SObject els)
170-- => Proxy (SObject els)
159-- => Proxy (SObject els)
171-- -> Schema
160-- -> Schema
172-- toSchema p = constructor p $ schema (Proxy @(JT (SObject els))) (Proxy @els)
161-- toSchema p = constructor p $ schema (Proxy @(JT (SObject els))) (Proxy @els)
174−type TestStruct = SObject '[ Field "carrier" 'JText [SText '[LengthEqNat 3] ] ]