aboutsummaryrefslogtreecommitdiff
path: root/src/Data/Array/Nested/Mixed/Shape.hs
diff options
context:
space:
mode:
authorMikolaj Konarski <mikolaj.konarski@funktory.com>2025-12-25 23:45:41 +0100
committerMikolaj Konarski <mikolaj.konarski@funktory.com>2025-12-27 12:17:48 +0100
commit1f44ef9ce2e6cee4f71b044ffe0b01cd37603790 (patch)
treeefc891c5626d9bba073bf34bc31d0522aeb92f75 /src/Data/Array/Nested/Mixed/Shape.hs
parent2cf2817f321f705cb0d97d2188c17067915507ea (diff)
Add pragmas to functions that -fprof-late-overloaded-calls reports
as breaking the chain of specialization (but it's currently broken, so these may be false positives, but these pragmas may be handy in the future anyway and they can't do much harm in theory and in practice they are right now neutral performance-wise).
Diffstat (limited to 'src/Data/Array/Nested/Mixed/Shape.hs')
-rw-r--r--src/Data/Array/Nested/Mixed/Shape.hs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Data/Array/Nested/Mixed/Shape.hs b/src/Data/Array/Nested/Mixed/Shape.hs
index de1c770..b3f0c2f 100644
--- a/src/Data/Array/Nested/Mixed/Shape.hs
+++ b/src/Data/Array/Nested/Mixed/Shape.hs
@@ -355,9 +355,16 @@ data ListH sh i where
-- TODO: bring this UNPACK back when GHC no longer crashes:
-- ConsKnown :: forall n sh i. {-# UNPACK #-} SNat n -> ListH sh i -> ListH (Just n : sh) i
ConsKnown :: forall n sh i. SNat n -> ListH sh i -> ListH (Just n : sh) i
-deriving instance Eq i => Eq (ListH sh i)
deriving instance Ord i => Ord (ListH sh i)
+-- A manually defined instance and this INLINEABLE is needed to specialize
+-- mdot1Inner (otherwise GHC warns specialization breaks down here).
+instance Eq i => Eq (ListH sh i) where
+ {-# INLINEABLE (==) #-}
+ ZH == ZH = True
+ ConsUnknown i1 sh1 == ConsUnknown i2 sh2 = i1 == i2 && sh1 == sh2
+ ConsKnown _ sh1 == ConsKnown _ sh2 = sh1 == sh2
+
#ifdef OXAR_DEFAULT_SHOW_INSTANCES
deriving instance Show i => Show (ListH sh i)
#else