Opened 3 years ago

Last modified 3 years ago

#12640 new bug

Class member functions not substituted for MultiParamTypeClasses

Reported by: jeremy-list Owned by:
Priority: normal Milestone:
Component: Compiler Version: 8.0.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Runtime performance bug Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


When the following code is compiled with "-O2 -ddump-rule-firings" the rule is not fired: presumably because the simplifier does not recognize that (+++) = ex_or.

{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies #-}
class Ex2 a b c | a b -> c where
  (+++) :: a -> b -> c

instance Ex2 Bool Bool Bool where
  (+++) = ex_or

{-# INLINE [2] ex_or #-}
ex_or = (||)

"force-inline" forall a b . ex_or a b = a || b

main = print (True +++ True)

Change History (2)

comment:1 Changed 3 years ago by akio

Changing the INLINE [2] to INLINE [1] allows the rule to fire.

I believe the issue is that an INLINE [2] is essentially the same as an INLINE with no phase specifier, because by default 2 is the first simplifier phase.

comment:2 Changed 3 years ago by simonpj

Akio is correct.

Note: See TracTickets for help on using tickets.