summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMikolaj Konarski <mikolaj.konarski@gmail.com>2024-04-21 23:13:42 +0200
committerMikolaj Konarski <mikolaj.konarski@gmail.com>2024-04-21 23:13:42 +0200
commit4def20b2699f8268ba7d03f3a228273ff613dc0d (patch)
tree4994299865d50b3d51a91976e5217b2c85086b22 /src
parentf29e8a37daf2ed55ea849c286e1bfb1025b67329 (diff)
Derive also the Ord instance for sized lists
Diffstat (limited to 'src')
-rw-r--r--src/Data/Array/Mixed.hs1
-rw-r--r--src/Data/Array/Nested/Internal.hs10
2 files changed, 7 insertions, 4 deletions
diff --git a/src/Data/Array/Mixed.hs b/src/Data/Array/Mixed.hs
index 8b90547..47027cb 100644
--- a/src/Data/Array/Mixed.hs
+++ b/src/Data/Array/Mixed.hs
@@ -54,6 +54,7 @@ data IxX sh i where
(:.?) :: forall sh i. i -> IxX sh i -> IxX (Nothing : sh) i
deriving instance Show i => Show (IxX sh i)
deriving instance Eq i => Eq (IxX sh i)
+deriving instance Ord i => Ord (IxX sh i)
infixr 3 :.@
infixr 3 :.?
diff --git a/src/Data/Array/Nested/Internal.hs b/src/Data/Array/Nested/Internal.hs
index b758e55..4dc39c3 100644
--- a/src/Data/Array/Nested/Internal.hs
+++ b/src/Data/Array/Nested/Internal.hs
@@ -858,6 +858,7 @@ data ListR n i where
(:::) :: forall n i. i -> ListR n i -> ListR (S n) i
deriving instance Show i => Show (ListR n i)
deriving instance Eq i => Eq (ListR n i)
+deriving instance Ord i => Ord (ListR n i)
infixr 3 :::
deriving stock instance Functor (ListR n)
@@ -872,7 +873,7 @@ listRToList (i ::: is) = i : listRToList is
-- | An index into a rank-typed array.
type IxR :: INat -> Type -> Type
newtype IxR n i = IxR (ListR n i)
- deriving (Show, Eq)
+ deriving (Show, Eq, Ord)
deriving newtype instance Functor (IxR n)
@@ -902,7 +903,7 @@ type IIxR n = IxR n Int
type StaticShapeR :: INat -> Type -> Type
newtype StaticShapeR n i = StaticShapeR (ListR n i)
- deriving (Show, Eq)
+ deriving (Show, Eq, Ord)
deriving newtype instance Functor (StaticShapeR n)
@@ -1070,6 +1071,7 @@ data ListS sh i where
(::$) :: forall n sh i. i -> ListS sh i -> ListS (n : sh) i
deriving instance Show i => Show (ListS sh i)
deriving instance Eq i => Eq (ListS sh i)
+deriving instance Ord i => Ord (ListS sh i)
infixr 3 ::$
deriving stock instance Functor (ListS sh)
@@ -1089,7 +1091,7 @@ listSToList (i ::$ is) = i : listSToList is
-- from a 'KnownShape' dictionary.
type IxS :: [Nat] -> Type -> Type
newtype IxS sh i = IxS (ListS sh i)
- deriving (Show, Eq)
+ deriving (Show, Eq, Ord)
deriving newtype instance Functor (IxS sh)
@@ -1119,7 +1121,7 @@ type IIxS sh = IxS sh Int
type StaticShapeS :: [Nat] -> Type -> Type
newtype StaticShapeS sh i = StaticShapeS (ListS sh i)
- deriving (Show, Eq)
+ deriving (Show, Eq, Ord)
deriving newtype instance Functor (StaticShapeS sh)