[Haskell-cafe] Why isn't pattern matching lazy by default?
Peter Verswyvelen
bf3 at telenet.be
Wed Sep 19 06:42:10 EDT 2007
I'm experimenting with functional reactive programming for creating
simple 2D/3D video games and interactive apps, trying to develop my own
version of it from scratch, for learning Haskell.
I got stuck with an endless loop when trying to split a stream into a
pair of two streams (a kind of reactive if/then/else). Luckily I first
read the Haskell School of Expression so I remembered that pattern
matching is not lazy and this could be the cause, which it was (I had to
replace (x:xs) by ~(x:xs))
I could also fix the problem by not using pattern matching at all, using
head/tail calls instead.
Now why isn't pattern matching lazy by default? This seems odd for a
newbie since everything else is lazy by default.
Thanks,
Peter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20070919/b4d00cf4/attachment.htm
More information about the Haskell-Cafe
mailing list