git.iko.soy/typeable/schematic
on master help sign in
Type equality constraints in Data.Schematic.DSL
178970fDenis Redozubov
src/Data/Schematic/DSL.hs+6−6
@@ -18,9 +18,9 @@ import Data.Vinyl.Functor
18
18
19
19
20type Constructor a
20type Constructor a
21− = forall b. FSubset (FieldsOf a) b (FImage (FieldsOf a) b)
21+ = forall fields b. (fields ~ FieldsOf a, FSubset fields b (FImage fields b))
22− => Rec (Tagged (FieldsOf a) :. FieldRepr) b
22+ => Rec (Tagged fields :. FieldRepr) b
23− -> JsonRepr ('SchemaObject (FieldsOf a))
23+ -> JsonRepr ('SchemaObject fields)
24
24
25withRepr :: Constructor a
25withRepr :: Constructor a
26withRepr = ReprObject . rmap (unTagged . getCompose) . fcast
26withRepr = ReprObject . rmap (unTagged . getCompose) . fcast
@@ -66,9 +66,9 @@ type family FieldsOf (s :: Schema) :: [(Symbol, Schema)] where
66 FieldsOf ('SchemaObject fs) = fs
66 FieldsOf ('SchemaObject fs) = fs
67
67
68type FieldConstructor fn =
68type FieldConstructor fn =
69− forall fs. (Representable (ByField fn fs (FIndex fn fs)))
69+ forall byField fs. (byField ~ ByField fn fs (FIndex fn fs), Representable byField)
70− => Repr (ByField fn fs (FIndex fn fs))
70+ => Repr byField
71− -> (Tagged fs :. FieldRepr) '(fn, (ByField fn fs (FIndex fn fs)))
71+ -> (Tagged fs :. FieldRepr) '(fn, byField)
72
72
73field :: forall fn. KnownSymbol fn => FieldConstructor fn
73field :: forall fn. KnownSymbol fn => FieldConstructor fn
74field = Compose . Tagged . constructField (sing :: Sing fn) Proxy
74field = Compose . Tagged . constructField (sing :: Sing fn) Proxy