RE: Arrowcase1
Simon Peyton-Jones <[email protected]> Thu, 25 Jan 2007 09:31:22 +0000
| Newsgroups | gmane.comp.lang.haskell.cvs.all |
|---|---|
| Message-ID | <DCA83D5F3861C941808187D4D387875001549D4F78__7023.25462266362$1169717501$gmane$org@EA-EXMSG-C312.europe.corp.microsoft.com> |
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 =3D> a -> Int -> T a f ~(C (n+1) m) =3D (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 boun= d by the lazy pattern are n,m, *not* the dictionary d. So in mkSelectorBin= ds 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 i= s | > | 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 arrowcase= 1 | (and presumably anywhere else I handle patterns), but I don't know if | it will break anything elsewhere.