[GHC] #15599: typeclass inference depends on whether a module is exposed.

GHC ghc-devs at haskell.org
Mon Sep 3 18:53:09 UTC 2018


#15599: typeclass inference depends on whether a module is exposed.
-------------------------------------+-------------------------------------
           Reporter:  gleachkr       |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:  8.2.3
          Component:  Compiler       |           Version:  8.2.2
           Keywords:                 |  Operating System:  Linux
       Architecture:                 |   Type of failure:  Incorrect result
  Unknown/Multiple                   |  at runtime
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 My first bug report for GHC: I've found some strange behavior in GHC 8.2.2
 relating to typeclass inference.

 Essentially, for two identical modules, GHC infers for one of them that
 one typeclass instance applies, and for another that a different instance
 applies. The only language extensions involved are FlexibleInstances,
 MultiParamTypeClasses, GADTs, and ScopedTypeVariables. There are no
 INCOHERENT pragmas involved. The only difference between the two modules
 is that one of them (the one displaying correct typeclass inference) is an
 exposed module, while the other is not mentioned in the cabal file. The
 phenomenon affects other packages that import the original package---they
 display the incorrect behavior, rather than the correct behavior that the
 exposed module displays.

 The original discussion is here:
 [https://github.com/gleachkr/Carnap/issues/4]

 My best attempt at a minimal example can be found at
 [https://github.com/gleachkr/GHC-Repro]. You can run the "test.sh" script
 included there to see the phenomenon in action.

 I don't see this behavior in other GHC versions, but I'm told that bug
 reports for older GHC versions are welcome, so here I am.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15599>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list