GHC: Ticket #1080: Arrows desguaring does not take account of bindings in patterns
http://ghc.haskell.org/trac/ghc/ticket/1080
<p>
The test arrows/should_compile/arrowcase1 is failing Lint. The bug is in the desugarer.
</p>
<p>
Here’s a smaller test case:
</p>
<pre class="wiki">h :: ArrowChoice a => Int -> a (Int,Int) Int
h x = proc (y,z) -> case compare x y of
GT -> returnA -< z+x
</pre><p>
The type checker turns the case into
</p>
<pre class="wiki"> case compare x y of
GT { p77 = plusInt } -> returnA -< p77 z x
</pre><p>
Here p77 is a local binding for the (+) operation. In general, patterns can contain bindings (used to discharge constraints that are bound by the pattern). In this case the binding isn’t strictly necessary, but in general it is – consider existentials. It’s equivalent to adding a ‘let’ around the RHS, but since the patters are perhaps nested, and one pattern might use a constraint that is bound by another, the pattern is the right place to attach the binding.
</p>
<p>
This has come up because GHC is binding things a little earlier than before, but an existential would have exposed it before.
</p>
<p>
The trouble is that the suspicious-looking replaceLeaves code in DsArrows (line 528 or so) doesn’t know about these bindings.
</p>
<p>
I don’t understand DsArrows at all. Indeed the whole Arrows code feels smelly to me. Maybe we tried to share too much code?
</p>
<p>
I'm hoping Ross will look at this.
</p>
en-usGHChttp://ghc.haskell.org/trac/ghc/chrome/site/ghc_logo.png
http://ghc.haskell.org/trac/ghc/ticket/1080
Trac 1.0.9simonpjWed, 03 Jan 2007 12:09:59 GMTtestcase set
http://ghc.haskell.org/trac/ghc/ticket/1080#comment:1
http://ghc.haskell.org/trac/ghc/ticket/1080#comment:1
<ul>
<li><strong>testcase</strong>
set to <em>arrowcase1</em>
</li>
</ul>
TicketiglooThu, 25 Jan 2007 01:37:08 GMTmilestone set
http://ghc.haskell.org/trac/ghc/ticket/1080#comment:2
http://ghc.haskell.org/trac/ghc/ticket/1080#comment:2
<ul>
<li><strong>milestone</strong>
set to <em>6.6.1</em>
</li>
</ul>
TicketsimonpjTue, 30 Jan 2007 14:56:14 GMTattachment set
http://ghc.haskell.org/trac/ghc/ticket/1080
http://ghc.haskell.org/trac/ghc/ticket/1080
<ul>
<li><strong>attachment</strong>
set to <em>Ar.hs</em>
</li>
</ul>
TicketsimonpjTue, 30 Jan 2007 14:57:22 GMTowner changed
http://ghc.haskell.org/trac/ghc/ticket/1080#comment:3
http://ghc.haskell.org/trac/ghc/ticket/1080#comment:3
<ul>
<li><strong>owner</strong>
changed from <em>Ross Paterson</em> to <em>ross</em>
</li>
</ul>
<p>
See also <a class="closed ticket" href="http://ghc.haskell.org/trac/ghc/ticket/1124" title="bug: Panic! The impossible happened: initC srt (closed: duplicate)">#1124</a>, which is a dup of this one. I've added its code as an attachment, <tt>Ar.hs</tt>.
</p>
<p>
Simon
</p>
TicketrossFri, 16 Mar 2007 14:24:05 GMTversion, milestone changed
http://ghc.haskell.org/trac/ghc/ticket/1080#comment:4
http://ghc.haskell.org/trac/ghc/ticket/1080#comment:4
<ul>
<li><strong>version</strong>
changed from <em>6.6</em> to <em>6.7</em>
</li>
<li><strong>milestone</strong>
changed from <em>6.6.1</em> to <em>6.8</em>
</li>
</ul>
<p>
This affects the HEAD only.
</p>
<p>
Note that arrowrun004 now also fails core lint, with a similar binding problem.
</p>
TicketsimonpjMon, 07 May 2007 15:48:22 GMT
http://ghc.haskell.org/trac/ghc/ticket/1080#comment:5
http://ghc.haskell.org/trac/ghc/ticket/1080#comment:5
<p>
Ross says he'll get to this in mid to late June 2007.
</p>
<p>
Simon
</p>
TicketrossTue, 04 Sep 2007 00:17:30 GMTstatus changed; resolution set
http://ghc.haskell.org/trac/ghc/ticket/1080#comment:6
http://ghc.haskell.org/trac/ghc/ticket/1080#comment:6
<ul>
<li><strong>status</strong>
changed from <em>new</em> to <em>closed</em>
</li>
<li><strong>resolution</strong>
set to <em>fixed</em>
</li>
</ul>
TicketiglooMon, 05 Nov 2007 15:03:55 GMTmilestone changed
http://ghc.haskell.org/trac/ghc/ticket/1080#comment:7
http://ghc.haskell.org/trac/ghc/ticket/1080#comment:7
<ul>
<li><strong>milestone</strong>
changed from <em>6.8 branch</em> to <em>6.8.1</em>
</li>
</ul>
TicketsimonmarTue, 30 Sep 2008 15:40:06 GMTarchitecture changed
http://ghc.haskell.org/trac/ghc/ticket/1080#comment:8
http://ghc.haskell.org/trac/ghc/ticket/1080#comment:8
<ul>
<li><strong>architecture</strong>
changed from <em>Unknown</em> to <em>Unknown/Multiple</em>
</li>
</ul>
TicketsimonmarTue, 30 Sep 2008 15:51:12 GMTos changed
http://ghc.haskell.org/trac/ghc/ticket/1080#comment:9
http://ghc.haskell.org/trac/ghc/ticket/1080#comment:9
<ul>
<li><strong>os</strong>
changed from <em>Unknown</em> to <em>Unknown/Multiple</em>
</li>
</ul>
Ticket