diff options
author | Tom Smeding <tom@tomsmeding.com> | 2024-06-07 21:46:05 +0200 |
---|---|---|
committer | Tom Smeding <tom@tomsmeding.com> | 2024-06-07 21:46:05 +0200 |
commit | cf42449abd68cc5c5648a1321df21f3c481e8b87 (patch) | |
tree | d593fefbd6313fdc9c9bfe5fa13ab77462c43e5f /src/Data/Array/Nested/Internal | |
parent | 83da7fe89c52cf84b6181141b1b0f6ffcf4ecd7c (diff) |
Generalise Ord instances to full lexicographical order
Diffstat (limited to 'src/Data/Array/Nested/Internal')
-rw-r--r-- | src/Data/Array/Nested/Internal/Mixed.hs | 16 | ||||
-rw-r--r-- | src/Data/Array/Nested/Internal/Ranked.hs | 2 | ||||
-rw-r--r-- | src/Data/Array/Nested/Internal/Shaped.hs | 2 |
3 files changed, 10 insertions, 10 deletions
diff --git a/src/Data/Array/Nested/Internal/Mixed.hs b/src/Data/Array/Nested/Internal/Mixed.hs index 09fb82b..1776687 100644 --- a/src/Data/Array/Nested/Internal/Mixed.hs +++ b/src/Data/Array/Nested/Internal/Mixed.hs @@ -128,7 +128,7 @@ data instance Mixed sh (Primitive a) = M_Primitive !(IShX sh) !(XArray sh a) deriving (Show, Eq, Generic) -- | Only on scalars, because lexicographical ordering is strange on multi-dimensional arrays. -deriving instance (Ord a, Storable a) => Ord (Mixed '[] (Primitive a)) +deriving instance (Ord a, Storable a) => Ord (Mixed sh (Primitive a)) instance NFData a => NFData (Mixed sh (Primitive a)) @@ -143,13 +143,13 @@ newtype instance Mixed sh () = M_Nil (Mixed sh (Primitive ())) deriving (Show, E -- etc. -- [PRIMITIVE ELEMENT TYPES LIST] -deriving instance Ord (Mixed '[] Int) ; instance NFData (Mixed sh Int) -deriving instance Ord (Mixed '[] Int64) ; instance NFData (Mixed sh Int64) -deriving instance Ord (Mixed '[] Int32) ; instance NFData (Mixed sh Int32) -deriving instance Ord (Mixed '[] CInt) ; instance NFData (Mixed sh CInt) -deriving instance Ord (Mixed '[] Float) ; instance NFData (Mixed sh Float) -deriving instance Ord (Mixed '[] Double) ; instance NFData (Mixed sh Double) -deriving instance Ord (Mixed '[] ()) ; instance NFData (Mixed sh ()) +deriving instance Ord (Mixed sh Int) ; instance NFData (Mixed sh Int) +deriving instance Ord (Mixed sh Int64) ; instance NFData (Mixed sh Int64) +deriving instance Ord (Mixed sh Int32) ; instance NFData (Mixed sh Int32) +deriving instance Ord (Mixed sh CInt) ; instance NFData (Mixed sh CInt) +deriving instance Ord (Mixed sh Float) ; instance NFData (Mixed sh Float) +deriving instance Ord (Mixed sh Double) ; instance NFData (Mixed sh Double) +deriving instance Ord (Mixed sh ()) ; instance NFData (Mixed sh ()) data instance Mixed sh (a, b) = M_Tup2 !(Mixed sh a) !(Mixed sh b) deriving (Generic) deriving instance (Show (Mixed sh a), Show (Mixed sh b)) => Show (Mixed sh (a, b)) diff --git a/src/Data/Array/Nested/Internal/Ranked.hs b/src/Data/Array/Nested/Internal/Ranked.hs index f834d54..ec18899 100644 --- a/src/Data/Array/Nested/Internal/Ranked.hs +++ b/src/Data/Array/Nested/Internal/Ranked.hs @@ -59,7 +59,7 @@ type Ranked :: Nat -> Type -> Type newtype Ranked n a = Ranked (Mixed (Replicate n Nothing) a) deriving instance Show (Mixed (Replicate n Nothing) a) => Show (Ranked n a) deriving instance Eq (Mixed (Replicate n Nothing) a) => Eq (Ranked n a) -deriving instance Ord (Mixed '[] a) => Ord (Ranked 0 a) +deriving instance Ord (Mixed (Replicate n Nothing) a) => Ord (Ranked n a) deriving instance NFData (Mixed (Replicate n Nothing) a) => NFData (Ranked n a) -- just unwrap the newtype and defer to the general instance for nested arrays diff --git a/src/Data/Array/Nested/Internal/Shaped.hs b/src/Data/Array/Nested/Internal/Shaped.hs index c640a44..b4dc80d 100644 --- a/src/Data/Array/Nested/Internal/Shaped.hs +++ b/src/Data/Array/Nested/Internal/Shaped.hs @@ -57,7 +57,7 @@ type Shaped :: [Nat] -> Type -> Type newtype Shaped sh a = Shaped (Mixed (MapJust sh) a) deriving instance Show (Mixed (MapJust sh) a) => Show (Shaped sh a) deriving instance Eq (Mixed (MapJust sh) a) => Eq (Shaped sh a) -deriving instance Ord (Mixed '[] a) => Ord (Shaped '[] a) +deriving instance Ord (Mixed (MapJust sh) a) => Ord (Shaped sh a) deriving instance NFData (Mixed (MapJust sh) a) => NFData (Shaped sh a) -- just unwrap the newtype and defer to the general instance for nested arrays |