diff options
author | Tom Smeding <tom@tomsmeding.com> | 2025-02-18 10:26:51 +0100 |
---|---|---|
committer | Tom Smeding <tom@tomsmeding.com> | 2025-02-18 10:28:28 +0100 |
commit | 53e1886fc41f0691dff03f6ff0a88e58f042fa30 (patch) | |
tree | faa61437b683cc10a1ab10659cf558fc9d9d012f | |
parent | 00432bf95d1e3f756ff4b805389897b9dff2e169 (diff) |
Less pointless standalone Ord instances
-rw-r--r-- | src/Data/Array/Nested/Internal/Mixed.hs | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/src/Data/Array/Nested/Internal/Mixed.hs b/src/Data/Array/Nested/Internal/Mixed.hs index 7163a76..5417a1c 100644 --- a/src/Data/Array/Nested/Internal/Mixed.hs +++ b/src/Data/Array/Nested/Internal/Mixed.hs @@ -139,32 +139,19 @@ data family Mixed sh a -- ostensibly not exist; the full array is still empty. data instance Mixed sh (Primitive a) = M_Primitive !(IShX sh) !(XArray sh a) - deriving (Eq, Generic) - --- | Only on scalars, because lexicographical ordering is strange on multi-dimensional arrays. -deriving instance (Ord a, Storable a) => Ord (Mixed sh (Primitive a)) + deriving (Eq, Ord, Generic) -- [PRIMITIVE ELEMENT TYPES LIST] -newtype instance Mixed sh Bool = M_Bool (Mixed sh (Primitive Bool)) deriving (Eq, Generic) -newtype instance Mixed sh Int = M_Int (Mixed sh (Primitive Int)) deriving (Eq, Generic) -newtype instance Mixed sh Int64 = M_Int64 (Mixed sh (Primitive Int64)) deriving (Eq, Generic) -newtype instance Mixed sh Int32 = M_Int32 (Mixed sh (Primitive Int32)) deriving (Eq, Generic) -newtype instance Mixed sh CInt = M_CInt (Mixed sh (Primitive CInt)) deriving (Eq, Generic) -newtype instance Mixed sh Float = M_Float (Mixed sh (Primitive Float)) deriving (Eq, Generic) -newtype instance Mixed sh Double = M_Double (Mixed sh (Primitive Double)) deriving (Eq, Generic) -newtype instance Mixed sh () = M_Nil (Mixed sh (Primitive ())) deriving (Eq, Generic) -- no content, orthotope optimises this (via Vector) +newtype instance Mixed sh Bool = M_Bool (Mixed sh (Primitive Bool)) deriving (Eq, Ord, Generic) +newtype instance Mixed sh Int = M_Int (Mixed sh (Primitive Int)) deriving (Eq, Ord, Generic) +newtype instance Mixed sh Int64 = M_Int64 (Mixed sh (Primitive Int64)) deriving (Eq, Ord, Generic) +newtype instance Mixed sh Int32 = M_Int32 (Mixed sh (Primitive Int32)) deriving (Eq, Ord, Generic) +newtype instance Mixed sh CInt = M_CInt (Mixed sh (Primitive CInt)) deriving (Eq, Ord, Generic) +newtype instance Mixed sh Float = M_Float (Mixed sh (Primitive Float)) deriving (Eq, Ord, Generic) +newtype instance Mixed sh Double = M_Double (Mixed sh (Primitive Double)) deriving (Eq, Ord, Generic) +newtype instance Mixed sh () = M_Nil (Mixed sh (Primitive ())) deriving (Eq, Ord, Generic) -- no content, orthotope optimises this (via Vector) -- etc. --- [PRIMITIVE ELEMENT TYPES LIST] -deriving instance Ord (Mixed sh Bool) -deriving instance Ord (Mixed sh Int) -deriving instance Ord (Mixed sh Int64) -deriving instance Ord (Mixed sh Int32) -deriving instance Ord (Mixed sh CInt) -deriving instance Ord (Mixed sh Float) -deriving instance Ord (Mixed sh Double) -deriving instance Ord (Mixed sh ()) - data instance Mixed sh (a, b) = M_Tup2 !(Mixed sh a) !(Mixed sh b) deriving (Generic) -- etc., larger tuples (perhaps use generics to allow arbitrary product types) |