From 1f44ef9ce2e6cee4f71b044ffe0b01cd37603790 Mon Sep 17 00:00:00 2001 From: Mikolaj Konarski Date: Thu, 25 Dec 2025 23:45:41 +0100 Subject: 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). --- src/Data/Array/Nested/Mixed/Shape.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/Data/Array/Nested/Mixed/Shape.hs') 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 -- cgit v1.2.3-70-g09d2