on master help sign in
Ord instances for JsonRepr
868dab9Denis Redozubov
src/Data/Schematic/Migration.hs−1
@@ -4,7 +4,6 @@
4module Data.Schematic.Migration where
4module Data.Schematic.Migration where
5
5
6import Data.Kind
6import Data.Kind
7−import Data.List
8import Data.Schematic.DSL
7import Data.Schematic.DSL
9import Data.Schematic.Lens
8import Data.Schematic.Lens
10import Data.Schematic.Path
9import Data.Schematic.Path
src/Data/Schematic/Schema.hs+18
@@ -393,6 +393,24 @@ instance Eq (JsonRepr s) => Eq (JsonRepr ('SchemaArray as s)) where
393instance Eq (JsonRepr s) => Eq (JsonRepr ('SchemaOptional s)) where
393instance Eq (JsonRepr s) => Eq (JsonRepr ('SchemaOptional s)) where
394 ReprOptional a == ReprOptional b = a == b
394 ReprOptional a == ReprOptional b = a == b
395
395
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+
396instance IsList (JsonRepr ('SchemaArray cs s)) where
414instance IsList (JsonRepr ('SchemaArray cs s)) where
397 type Item (JsonRepr ('SchemaArray cs s)) = JsonRepr s
415 type Item (JsonRepr ('SchemaArray cs s)) = JsonRepr s
398 fromList = ReprArray . GHC.Exts.fromList
416 fromList = ReprArray . GHC.Exts.fromList