diff options
author | Mikolaj Konarski <mikolaj.konarski@gmail.com> | 2024-04-21 23:13:42 +0200 |
---|---|---|
committer | Mikolaj Konarski <mikolaj.konarski@gmail.com> | 2024-04-21 23:13:42 +0200 |
commit | 4def20b2699f8268ba7d03f3a228273ff613dc0d (patch) | |
tree | 4994299865d50b3d51a91976e5217b2c85086b22 /src/Data/Array/Nested/Internal.hs | |
parent | f29e8a37daf2ed55ea849c286e1bfb1025b67329 (diff) |
Derive also the Ord instance for sized lists
Diffstat (limited to 'src/Data/Array/Nested/Internal.hs')
-rw-r--r-- | src/Data/Array/Nested/Internal.hs | 10 |
1 files changed, 6 insertions, 4 deletions
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) |