on master help sign in
Add missing instances for SchemaUnion
446a306Nikita
src/Data/Schematic/Schema.hs+13−1
@@ -369,7 +369,7 @@ instance Show (JsonRepr ('SchemaNumber cs)) where
369 show (ReprNumber n) = "ReprNumber " P.++ show n
369 show (ReprNumber n) = "ReprNumber " P.++ show n
370
370
371instance Show (JsonRepr 'SchemaBoolean) where
371instance Show (JsonRepr 'SchemaBoolean) where
372− show (ReprBoolean n) = "ReprBoolena " P.++ show n
372+ show (ReprBoolean n) = "ReprBoolean " P.++ show n
373
373
374instance Show (JsonRepr 'SchemaNull) where show _ = "ReprNull"
374instance Show (JsonRepr 'SchemaNull) where show _ = "ReprNull"
375
375
@@ -382,6 +382,10 @@ instance V.RecAll FieldRepr fs Show => Show (JsonRepr ('SchemaObject fs)) where
382instance Show (JsonRepr s) => Show (JsonRepr ('SchemaOptional s)) where
382instance Show (JsonRepr s) => Show (JsonRepr ('SchemaOptional s)) where
383 show (ReprOptional s) = "ReprOptional " P.++ show s
383 show (ReprOptional s) = "ReprOptional " P.++ show s
384
384
385+instance Show (Union JsonRepr (h ': tl))
386+ => Show (JsonRepr ('SchemaUnion (h ': tl))) where
387+ show (ReprUnion s) = "ReprUnion " P.++ show s
388+
385instance Eq (Rec FieldRepr fs) => Eq (JsonRepr ('SchemaObject fs)) where
389instance Eq (Rec FieldRepr fs) => Eq (JsonRepr ('SchemaObject fs)) where
386 ReprObject a == ReprObject b = a == b
390 ReprObject a == ReprObject b = a == b
387
391
@@ -403,6 +407,10 @@ instance Eq (JsonRepr s) => Eq (JsonRepr ('SchemaArray as s)) where
403instance Eq (JsonRepr s) => Eq (JsonRepr ('SchemaOptional s)) where
407instance Eq (JsonRepr s) => Eq (JsonRepr ('SchemaOptional s)) where
404 ReprOptional a == ReprOptional b = a == b
408 ReprOptional a == ReprOptional b = a == b
405
409
410+instance Eq (Union JsonRepr (h ': tl))
411+ => Eq (JsonRepr ('SchemaUnion (h ': tl))) where
412+ ReprUnion a == ReprUnion b = a == b
413+
406instance Ord (Rec FieldRepr fs) => Ord (JsonRepr ('SchemaObject fs)) where
414instance Ord (Rec FieldRepr fs) => Ord (JsonRepr ('SchemaObject fs)) where
407 ReprObject a `compare` ReprObject b = a `compare` b
415 ReprObject a `compare` ReprObject b = a `compare` b
408
416
@@ -424,6 +432,10 @@ instance Ord (JsonRepr s) => Ord (JsonRepr ('SchemaArray as s)) where
424instance Ord (JsonRepr s) => Ord (JsonRepr ('SchemaOptional s)) where
432instance Ord (JsonRepr s) => Ord (JsonRepr ('SchemaOptional s)) where
425 ReprOptional a `compare` ReprOptional b = a `compare` b
433 ReprOptional a `compare` ReprOptional b = a `compare` b
426
434
435+instance Ord (Union JsonRepr (h ': tl))
436+ => Ord (JsonRepr ('SchemaUnion (h ': tl))) where
437+ ReprUnion a `compare` ReprUnion b = a `compare` b
438+
427instance IsList (JsonRepr ('SchemaArray cs s)) where
439instance IsList (JsonRepr ('SchemaArray cs s)) where
428 type Item (JsonRepr ('SchemaArray cs s)) = JsonRepr s
440 type Item (JsonRepr ('SchemaArray cs s)) = JsonRepr s
429 fromList = ReprArray . GHC.Exts.fromList
441 fromList = ReprArray . GHC.Exts.fromList