Re: exported pattern matching
Jim - it's worth looking at the proposal for views, proposed by Warren Burton et al, accessible from http://haskell.galois.com/cgi-bin/haskell-prime/trac.cgi/wiki/Views regards Simon T On Thu, 9 Feb 2006, Jim Apple wrote: Sometimes I'd like to use a smart constructor but have pattern matching as well. There has been talk elsewhere of allowing export of data constructors for /matching/ but not for /construction/: module One- data Picky a = Nil | One a picky x = if some_complex_thing x then One x else Nil module Two- f x = g $ picky x g Nil y = y g (One x) y = x h Nil = One True - I'd like for the function g to be fine and the function h to get a complaint like error: no constructor 'One' or, even better, error: 'One' only works in pattern matching Jim ___ Haskell-prime mailing list Haskell-prime@haskell.org http://haskell.org/mailman/listinfo/haskell-prime ___ Haskell-prime mailing list Haskell-prime@haskell.org http://haskell.org/mailman/listinfo/haskell-prime
Re: exported pattern matching
On Thu, 9 Feb 2006, S.J.Thompson wrote: Jim - it's worth looking at the proposal for views, proposed by Warren Burton et al, accessible from http://haskell.galois.com/cgi-bin/haskell-prime/trac.cgi/wiki/Views Myself I'm of the view transformational patterns (as described in http://citeseer.ist.psu.edu/299277.html) are more interesting - I can't help wondering why they were never implemented? -- [EMAIL PROTECTED] My religion says so explains your beliefs. But it doesn't explain why I should hold them as well, let alone be restricted by them. ___ Haskell-prime mailing list Haskell-prime@haskell.org http://haskell.org/mailman/listinfo/haskell-prime
Re: exported pattern matching
Philippa Cowderoy wrote: Myself I'm of the view transformational patterns (as described in http://citeseer.ist.psu.edu/299277.html) are more interesting - I can't help wondering why they were never implemented? Maybe because of tricky semantics. I'm not quite sure what case x of (y,z)!f - ... where f _ = (z,3) should desugar to. -- Ben ___ Haskell-prime mailing list Haskell-prime@haskell.org http://haskell.org/mailman/listinfo/haskell-prime
exported pattern matching
Sometimes I'd like to use a smart constructor but have pattern matching as well. There has been talk elsewhere of allowing export of data constructors for /matching/ but not for /construction/: module One- data Picky a = Nil | One a picky x = if some_complex_thing x then One x else Nil module Two- f x = g $ picky x g Nil y = y g (One x) y = x h Nil = One True - I'd like for the function g to be fine and the function h to get a complaint like error: no constructor 'One' or, even better, error: 'One' only works in pattern matching Jim ___ Haskell-prime mailing list Haskell-prime@haskell.org http://haskell.org/mailman/listinfo/haskell-prime