Skip to content

Not enough inlining happens with single-method type classes

In the attached file, GHC produces code (with -O2) for foo that references a top-level definition of type Small (Either () ()), despite the fact that all bindings in the module are marked INLINE.

If I use -DOTHER_METHOD to add another method to the class, this problem goes away. It looks like a ClassOp rule is helping here.

I'm not sure if this is a bug, but it was a surprising behavior for me, so I'm reporting it. Please feel free to close this ticket if it's the correct behavior.

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