[GHC] #11224: Program doesn't preserve semantics after pattern synonym inlining.

GHC ghc-devs at haskell.org
Tue Dec 15 23:20:15 UTC 2015


#11224: Program doesn't preserve semantics after pattern synonym inlining.
-------------------------------------+-------------------------------------
        Reporter:  anton.dubovik     |                Owner:
            Type:  bug               |               Status:  new
        Priority:  highest           |            Milestone:  8.0.1
       Component:  Compiler          |              Version:  7.10.2
      Resolution:                    |             Keywords:
                                     |  PatternSynonyms
Operating System:  Windows           |         Architecture:  x86_64
 Type of failure:  Incorrect result  |  (amd64)
  at runtime                         |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #11225            |  Differential Rev(s):  Phab:D1632
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 OK, back to this ticket.  I think we were just getting ourselves confused.

  * The type of `PRead` is definitely
 {{{
 pattern PRead :: Read a => () => a -> String
 }}}
   That is, `(Read a)` is required (to perform the match), not provided (by
 being bound by the match).  And `a` is certainly not existential.

  * The existential type variables are simply the ones bound existentially
 by the actual pattern.  As Matthew says, we can't work out which ones they
 are by looking at the type (that was a hefalump trap, which I fell into).
 In this example, there are no existential variables.

  * We have a perfectly good function that discovers which the existential
 variables are, called `tcCollectEx`.  It's used in the inference case and
 we can certainly use it in the checking case too.

  * Since we can't tell which is which before `tcCheckPatSyn`, we should
 not split them up in `TcBinds.tcTySig`.  They can all be in one list in
 the `TPSI` record.

  * Looking at `tcCheckPatSyn` it's a good deal more complicated than
 necessary.  I'll fix that.

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


More information about the ghc-tickets mailing list