Skip to content

Class member functions not substituted for MultiParamTypeClasses

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 = (||)

{-# RULES
"force-inline" forall a b . ex_or a b = a || b
 #-}

main = print (True +++ True)
Trac metadata
Trac field Value
Version 8.0.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information