Skip to content

Commit 868dab9

Browse files
committed
Ord instances for JsonRepr
1 parent bdb096d commit 868dab9

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/Data/Schematic/Migration.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
module Data.Schematic.Migration where
55

66
import Data.Kind
7-
import Data.List
87
import Data.Schematic.DSL
98
import Data.Schematic.Lens
109
import Data.Schematic.Path

src/Data/Schematic/Schema.hs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,24 @@ instance Eq (JsonRepr s) => Eq (JsonRepr ('SchemaArray as s)) where
393393
instance 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+
396414
instance IsList (JsonRepr ('SchemaArray cs s)) where
397415
type Item (JsonRepr ('SchemaArray cs s)) = JsonRepr s
398416
fromList = ReprArray . GHC.Exts.fromList

0 commit comments

Comments
 (0)