[GHC] #12201: Wrong instance selection with overlapping instances and local bindings

GHC ghc-devs at haskell.org
Fri Jun 17 15:00:44 UTC 2016


#12201: Wrong instance selection with overlapping instances and local bindings
-------------------------------------+-------------------------------------
        Reporter:  kanetw            |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:  8.0.1
  checker)                           |
      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 kanetw):

 Still present on latest HEAD:
 {{{
 GHCi, version 8.1.20160616: http://www.haskell.org/ghc/  :? for help
 [1 of 1] Compiling Bug              ( /home/kane/ghc8-instance-bug/Bug.hs,
 interpreted )

 /home/kane/ghc8-instance-bug/Bug.hs:22:1: warning: [-Wsimplifiable-class-
 constraints]
     The constraint ‘A (Foo s Bool)’ matches an instance declaration
     instance A (Foo s a)
       -- Defined at /home/kane/ghc8-instance-bug/Bug.hs:9:10
     This makes type inference very fragile;
       try simplifying it using the instance
 Ok, modules loaded: Bug.
 *Bug> :t test
 test :: A (Foo s Bool) => s -> Int
 *Bug> :t test2
 test2 :: s -> Int
 }}}

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


More information about the ghc-tickets mailing list