[GHC] #8644: 'Untouchable' error with constraint variable in rank-2 type

GHC ghc-devs at haskell.org
Fri Jan 3 16:14:30 UTC 2014


#8644: 'Untouchable' error with constraint variable in rank-2 type
----------------------------------------------+----------------------------
        Reporter:  sbarclay                   |            Owner:
            Type:  bug                        |           Status:  new
        Priority:  normal                     |        Milestone:
       Component:  Compiler (Type checker)    |          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:
----------------------------------------------+----------------------------

Comment (by Simon Peyton Jones <simonpj@…>):

 In [changeset:"9e10d1883d7ea5ea422cda79b426f51d2b59b14d/ghc"]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="9e10d1883d7ea5ea422cda79b426f51d2b59b14d"
 Improve the equality-floating story (again), to fix Trac #8644

 We float equalities out of implications whose 'givens' include equalities.
 But it's a bit tricky knowing whether some givens do or do not include
 equalities, as #8644 shows.  There the given has type 'c' (which might
 have equalities), but we discover that 'c ~ ()', which definitely doesn't.

 In short, we must look at the givens *after* normalisation, not before.
 Moreover, something similar happens in approximateWC, where we need
 to ask whether an implication has given equalities.

 This patch does the job:

 * Add a Boolean field inert_no_eqs to InertCans, which records
   whether we've added a non-constant equality

 * Add a field ic_no_eqs to Implication, which records whether the
   ic_given binders include any equalities

 * Get rid of Inst.hasEqualities altogether

 On the way I did some un-forced refactoring

 * Introduce the auxiliary function TcCanonical.flattenNestedFamApp

 * Kill off FamHeadMap and PredMap in favour of
   the new FunEqMap and DictMap respectively
 }}}

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


More information about the ghc-tickets mailing list