[GHC] #13061: Incorrect constraints given single flexible undecidable instance.

GHC ghc-devs at haskell.org
Tue Jan 3 21:19:51 UTC 2017


#13061: Incorrect constraints given single flexible undecidable instance.
-------------------------------------+-------------------------------------
        Reporter:  JCarr             |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:  8.0.1
  checker)                           |             Keywords:  Constraint,
      Resolution:                    |  UndecidableInstances,
                                     |  FlexibleInstances
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  GHC rejects       |  Unknown/Multiple
  valid program                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by goldfire):

 Interesting. This happens because when you bind a variable with
 `let`/`where`, GHC simplifies the type. In your case, it simplifies `A a
 => a -> a` to `Eq a => a -> a`, choosing the `Eq a => A a` instance. This
 is a bit bogus, though, because `Eq a => a -> a` is not actually more
 general than `A a => a -> a` in the presence of other instances.

 I'm not sure what to do here, really. I think this may just be an oddity
 of `FlexibleInstances`.

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


More information about the ghc-tickets mailing list