[Haskell] View patterns in GHC: Request for feedback

Andreas Marth Andreas-Haskell at gmx.net
Tue Jul 24 19:20:09 EDT 2007

I find that the suggested view pattern produce quite obfuscated code!
I guess it sets the language barrier quite a bit higher.
Do you really think a normal progrogrammer understands:
insert x s@(has x -> Just _) = s
fib (np 2 -> Just n) = fib (n + 1) + fib n
or even:
fib (np 2 => n) = fib (n + 1) + fib n

Do you really know what
fun f z [] = z
fun f z (x : fun f z -> xs) =  x `f` xs
I find it really hides the most important fact that fun is recursive.
(If you didn't recognize fun: it is foldr.)

I didn't see 1 convincing excample for the "need" of view pattern in that
paper and  I didn't read the other proposals.

Kind regards

----- Original Message -----
From: "Dan Licata" <drl at cs.cmu.edu>
To: <haskell at haskell.org>
Sent: Monday, July 23, 2007 11:09 AM
Subject: [Haskell] View patterns in GHC: Request for feedback

> Hi everyone,
> Simon PJ and I are implementing view patterns, a way of pattern matching
> against abstract datatypes, in GHC.  Our design is described here:
> http://hackage.haskell.org/trac/ghc/wiki/ViewPatterns
> If you have any comments or suggestions about this design, we'd love to
> hear them.  You can respond to this list (and we can take it to
> haskell-cafe if the thread gets long) or, if you prefer, directly to me.
> Thanks!
> -Dan
> _______________________________________________
> Haskell mailing list
> Haskell at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell

More information about the Haskell mailing list