Re: [Haskell] Views in Haskell

2007-01-24 Thread Dinko Tenev
On 1/24/07, Brian Hulley [EMAIL PROTECTED] wrote: A possible syntax could represent the value being matched explicitly, say using ? to represent the value currently being matched, then the pattern could be written as an equation: f (prodSize ? = Small) = ... f (prodSize ? = Medium) =

Re: [Haskell] Views in Haskell

2007-01-24 Thread Claus Reinke
-- abstract list deconstructors / list pattern constructors -- (consP takes h/t sub-patterns as parameters) consP h t l = do { guard $ not (null l); hr - h (head l); tr - t (tail l); return (hr,tr) } nilP l = do { guard $ null l; return () } -- wildcard and variable patterns

Re: [Haskell] Views in Haskell

2007-01-24 Thread Rene de Visser
In my opinion, views are going to make more Haskell more complicated, and from what I have seen so far, for little gain. Maybe a poll should be made to see what features the average Haskeller feels the most in need of. Or what their greatest problems are. Going by the traffic over the previous

Views in Haskell

2007-01-24 Thread Simon Peyton-Jones
There's been lots of interesting feedback about the views proposal -- thank you. Many of the suggestions amount to plausible design alternatives. If I do all the editing, I'll just become a bottleneck, and I'm more than usually snowed-under at the moment. So I've moved the Wiki page to the

RE: [Haskell] Views in Haskell

2007-01-24 Thread Simon Peyton-Jones
| 1 I am a bit concerned about the use of non-linear patterns in your examples. | There are good arguments for non-linear patterns, and Haskellers have made good | arguments against non-linear patterns. But you seem to suggest allowing non-linear | patterns in some cases (related to

Re: [Haskell] Views in Haskell

2007-01-24 Thread Philippa Cowderoy
On Wed, 24 Jan 2007, Claus Reinke wrote: the alternative I'm aiming for, as exhibited in the consP example, would be to build patterns systematically from view patterns used as abstract de-constructors, composed in the same way as one would compose the abstract constructors to build the

[Haskell] Views in Haskell

2007-01-24 Thread Mark Tullsen
Sorry to enter the discussion a little late ... First, I'm not clear what Simon meant by first class abstractions in this comment Several proposals suggest first class abstractions rather that first-class patterns. Here are the ones I know of ... Second, I completely agree with Claus in

Re: [Haskell] Views in Haskell

2007-01-24 Thread Mark Tullsen
On Jan 22, 2007, at 6:57 AM, Simon Peyton-Jones wrote: I'm thinking of implementing it in GHC, so I'd be interested in feedback of the form - how desirable is it to have a feature of this general form? While it looks like a useful extension with a lot of bang for the buck, I think