#1662: mistranslation of arrow notation
----------------------------------------+-----------------------------------
Reporter: ross | Owner: igloo
Type: merge | Status: new
Priority: normal | Milestone: 6.8 branch
Component: Compiler (Type checker) | Version: 6.7
Severity: normal | Resolution:
Keywords: | Difficulty: Unknown
Os: Multiple | Testcase: arrowrun004, arrowpat
Architecture: Multiple |
----------------------------------------+-----------------------------------
Changes (by simonpj):
* testcase: arrowrun004 => arrowrun004, arrowpat
* status: assigned => new
* type: bug => merge
* owner: ross => igloo
Comment:
After a conversation with Ross I understand what is going on. Here's the
new comment in `TcPat`
{{{
Note [Arrows and patterns]
~~~~~~~~~~~~~~~~~~~~~~~~~~
(Oct 07) Arrow noation has the odd property that it involves
"holes in the scope". For example:
expr :: Arrow a => a () Int
expr = proc (y,z) -> do
x <- term -< y
expr' -< x
Here the 'proc (y,z)' binding scopes over the arrow tails but not the
arrow body (e.g 'term'). As things stand (bogusly) all the
constraints from the proc body are gathered together, so constraints
from 'term' will be seen by the tcPat for (y,z). But we must *not*
bind constraints from 'term' here, becuase the desugarer will not make
these bindings scope over 'term'.
The Right Thing is not to confuse these constraints together. But for
now the Easy Thing is to ensure that we do not have existential or
GADT constraints in a 'proc', and to short-cut the constraint
simplification for such vanilla patterns so that it binds no
constraints. Hence the 'fast path' in tcConPat; but it's also a good
plan for ordinary vanilla patterns to bypass the constraint
simplification step.
}}}
So this bug is not really fixed properly; but it's significantly improved.
See Task #1777.
Ian please merge
{{{
Tue Oct 16 13:47:10 BST 2007 [EMAIL PROTECTED]
* Fix #1662: do not simplify constraints for vanilla pattern matches
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1662#comment:7>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs