[GHC] #8390: regression in handling of type variables in constraints on instances which do not appear in the instance head

GHC ghc-devs
Thu Oct 3 14:49:40 UTC 2013


#8390: regression in handling of type variables in constraints on instances which
do not appear in the instance head
----------------------------------------------+----------------------------
        Reporter:  aavogt                     |            Owner:
            Type:  bug                        |           Status:  new
        Priority:  normal                     |        Milestone:
       Component:  Compiler                   |          Version:  7.7
      Resolution:                             |         Keywords:
Operating System:  Unknown/Multiple           |     Architecture:
 Type of failure:  GHC rejects valid program  |  Unknown/Multiple
       Test Case:                             |       Difficulty:  Unknown
        Blocking:                             |       Blocked By:
                                              |  Related Tickets:
----------------------------------------------+----------------------------
Changes (by goldfire):

 * status:  closed => new
 * resolution:  invalid =>


Comment:

 Though my head goes a little swimmy when I look at this for too long, I
 think the ambiguity checker in 7.7 is being overeager here.  I can use the
 `Compose` instance for `Fun` without any type annotations, so therefore,
 its type is not ambiguous. It seems that the equality constraints on the
 `F` instance induce what are effectively functional dependencies. Once we
 know that the first parameter to `Fun` is `F`, we know that the next two
 must be `Int`.

 I'm still a little lost as to how to characterize this behavior, and I
 could understand an argument saying that the ambiguity checker should
 reject this code. But, we should then also admit that the ambiguity
 checker is somewhat liberal, rejecting more than is necessary.

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



More information about the ghc-tickets mailing list