aboutsummaryrefslogtreecommitdiff
path: root/src/Data/Array/Nested/Internal
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2025-02-18 10:38:30 +0100
committerTom Smeding <tom@tomsmeding.com>2025-02-18 10:38:30 +0100
commitd5402b39f31f4cf56a8f583f1d6ceaf7a8aa5acf (patch)
tree4cdf136ba3a79bb01b04300d0efc8e264ed0b487 /src/Data/Array/Nested/Internal
parent53e1886fc41f0691dff03f6ff0a88e58f042fa30 (diff)
All arrays are Eq and Ord (they compare shape first, then values)HEADmaster
This comparison policy is lifted straight from orthotope (and indeed the instances are all just auto-derived).
Diffstat (limited to 'src/Data/Array/Nested/Internal')
-rw-r--r--src/Data/Array/Nested/Internal/Mixed.hs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/Data/Array/Nested/Internal/Mixed.hs b/src/Data/Array/Nested/Internal/Mixed.hs
index 5417a1c..d8b7912 100644
--- a/src/Data/Array/Nested/Internal/Mixed.hs
+++ b/src/Data/Array/Nested/Internal/Mixed.hs
@@ -155,8 +155,14 @@ newtype instance Mixed sh () = M_Nil (Mixed sh (Primitive ())) deriving (Eq, Ord
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)
+deriving instance (Eq (Mixed sh a), Eq (Mixed sh b)) => Eq (Mixed sh (a, b))
+deriving instance (Ord (Mixed sh a), Ord (Mixed sh b)) => Ord (Mixed sh (a, b))
+
data instance Mixed sh1 (Mixed sh2 a) = M_Nest !(IShX sh1) !(Mixed (sh1 ++ sh2) a) deriving (Generic)
+deriving instance Eq (Mixed (sh1 ++ sh2) a) => Eq (Mixed sh1 (Mixed sh2 a))
+deriving instance Ord (Mixed (sh1 ++ sh2) a) => Ord (Mixed sh1 (Mixed sh2 a))
+
-- | Internal helper data family mirroring 'Mixed' that consists of mutable
-- vectors instead of 'XArray's.