Ross

I think the safest thing to do is to write a new pat-binder-collector.
Here's the problem.  Consider

data T a where
   C :: Num a => a -> Int -> T a

f ~(C (n+1) m) = (n,m)

Here, the pattern (C (n+1)) binds a hidden dictionary (d::Num a), and *also* 
uses that dictionary to match the (n+1) pattern.  Yet, the variables bound by 
the lazy pattern are n,m, *not* the dictionary d.  So in mkSelectorBinds in 
DsUtils, we want just m,n as the variables bound.


Perhaps when you do this, you could add this example, plus one about arrows, to 
explain why the two purposes need two different functions?

Thanks

Simon

| -----Original Message-----
| From: Ross Paterson [mailto:[EMAIL PROTECTED]
| Sent: 14 January 2007 01:06
| To: Simon Peyton-Jones
| Cc: [EMAIL PROTECTED]
| Subject: Re: Arrowcase1
|
| On Mon, Jan 08, 2007 at 12:01:42PM +0000, Simon Peyton-Jones wrote:
| > | In the comment under collectPatsBinders, ignoring dictionary binders in
| > | ConPatOut is justified in terms of lazy patterns.  Presumably there is
| > | more to this story, because if such dictionaries are guaranteed to be
| > | unused it would be safe for arrows too.
| >
| > They are only unused in lazy patterns, but not for strict ones.  Indeed,
| > they should be *empty* for lazy patterns; so I guess it'd be safe to
| > gather the dict bindings too, if that makes it easier for you.
|
| Changing the ConPatOut line to also collect the pat_binds fixes arrowcase1
| (and presumably anywhere else I handle patterns), but I don't know if
| it will break anything elsewhere.

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

Reply via email to