git.iko.soy/typeable/schematic
on master help sign in
Ord instances for JsonRepr
commit868dab9e95a10b43ff86a9db61093bdf78ec629d authorDenis Redozubov <denis.redozubov@gmail.com> dateThu 24 Jan 2019, 20:45 (8 years ago) parentbdb096d
2 files changed+18−1
src/Data/Schematic/Migration.hs−1 src/Data/Schematic/Schema.hs+18
src/Data/Schematic/Migration.hs−1
@@ -4,7 +4,6 @@
44module Data.Schematic.Migration where
55
66import Data.Kind
7−import Data.List
87import Data.Schematic.DSL
98import Data.Schematic.Lens
109import Data.Schematic.Path
src/Data/Schematic/Schema.hs+18
@@ -393,6 +393,24 @@ instance Eq (JsonRepr s) => Eq (JsonRepr ('SchemaArray as s)) where
393393instance Eq (JsonRepr s) => Eq (JsonRepr ('SchemaOptional s)) where
394394 ReprOptional a == ReprOptional b = a == b
395395
396+instance Ord (Rec FieldRepr fs) => Ord (JsonRepr ('SchemaObject fs)) where
397+ ReprObject a `compare` ReprObject b = a `compare` b
398+
399+instance Ord (JsonRepr ('SchemaText cs)) where
400+ ReprText a `compare` ReprText b = a `compare` b
401+
402+instance Ord (JsonRepr ('SchemaNumber cs)) where
403+ ReprNumber a `compare` ReprNumber b = a `compare` b
404+
405+instance Ord (JsonRepr 'SchemaNull) where
406+ compare _ _ = EQ
407+
408+instance Ord (JsonRepr s) => Ord (JsonRepr ('SchemaArray as s)) where
409+ ReprArray a `compare` ReprArray b = a `compare` b
410+
411+instance Ord (JsonRepr s) => Ord (JsonRepr ('SchemaOptional s)) where
412+ ReprOptional a `compare` ReprOptional b = a `compare` b
413+
396414instance IsList (JsonRepr ('SchemaArray cs s)) where
397415 type Item (JsonRepr ('SchemaArray cs s)) = JsonRepr s
398416 fromList = ReprArray . GHC.Exts.fromList