On Wed, Jan 03, 2007 at 12:10:09PM +0000, Simon Peyton-Jones wrote:
> Here's a smaller test case:
> 
> h :: ArrowChoice a => Int -> a (Int,Int) Int
> h x = proc (y,z) -> case compare x y of
>                 GT -> returnA -< z+x
> 
> The type checker turns the case into
> 
>                 case compare x y of
>                   GT { p77 = plusInt } -> returnA -< p77 z x
> 
> 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 patterns 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.

OK, so I'll need to put p77 in the pipe along with x and z.  I think
my problem is I'm using collectPatsBinders to get the vars bound by
a pattern, but it deliberately doesn't include dictionary binders
from ConPatOut.  Am I going to get the same issue everywhere there
are patterns?

> I don't understand DsArrows at all.  Indeed the whole Arrows code
> feels smelly to me.

It is a house of horrors, I'll admit, but it does a horrible job.

> Maybe we tried to share too much code?

Contrariwise, I think that using the same structures for commands that
correspond to expressions was the right thing to do.  The complications
arise because the DsArrows stuff does its own computations of what's in
scope (so it knows exactly what to put in the pipe), doubtless duplicating
what's done elsewhere.

_______________________________________________
Cvs-ghc mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to