[GHC] #8044: "Inaccessible code" error reported in wrong place

GHC ghc-devs at haskell.org
Mon Jul 8 11:59:53 CEST 2013


#8044: "Inaccessible code" error reported in wrong place
--------------------------------------------+------------------------------
        Reporter:  goldfire                 |            Owner:
            Type:  bug                      |           Status:  new
        Priority:  normal                   |        Milestone:
       Component:  Compiler (Type checker)  |          Version:  7.7
      Resolution:                           |         Keywords:  GADTs
Operating System:  Unknown/Multiple         |     Architecture:
 Type of failure:  None/Unknown             |  Unknown/Multiple
       Test Case:                           |       Difficulty:  Unknown
        Blocking:                           |       Blocked By:
                                            |  Related Tickets:
--------------------------------------------+------------------------------
Changes (by simonpj):

 * cc: dimitris@… (added)


Comment:

 Interesting.

 From the constraints we get:
 {{{
    ((a ~ Int) => X (Frob a) ~ X Int)    -- (A) From first eqn for Frob
 &  X (Frob a) ~ X Char                  -- (B) From second eqn
 }}}
 Now the first constraint (A) all by itself is soluble: substitute `Int`
 for `a`, simplify `(Frob Int)` and you are done.

 But in general we use type-function equality constraints (including as-
 yet-unsolved constraints) from outside an implication and push them
 inwards as "givens" (see `Note [Preparing inert set for implications]` in
 `TcSMonad`).  So we push in a given
 {{{
   Frob a ~ Char
 }}}
 into (A) and that leads to `Int~Char` and the error.

 I think we should narrow the "push in wanteds" stuff. I'll have a go at
 that.

 Simon

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



More information about the ghc-tickets mailing list