
#15125: Typeclass instance selection depends on the optimisation level -------------------------------------+------------------------------------- Reporter: nicuveo | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.2.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by nicuveo): Yes, I'm using the version in the tarball; I simplified it for the purpose of the bug description. And my apologies: I double-checked, and indeed, the code in the tarball works for 8.4.2; my stack setup was wrong. Sorry about that! ...however, sadly, there is the other bug I highlight in comment:6. If you replace //A.hs// to read: {{{#!hs instance A a where someValue = const Nothing }}} and //B.hs// to read: {{{#!hs instance {-# OVERLAPPING #-} A B where someValue (B x) = Just x }}} Then the same behaviour is back with 8.4.2: with -O0, it prints 42, with -O2, it prints 0. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15125#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler