[Haskell-cafe] Why isn't pattern matching lazy by default?

Henning Thielemann lemming at henning-thielemann.de
Wed Sep 19 11:24:43 EDT 2007

On Wed, 19 Sep 2007, Peter Verswyvelen wrote:

> 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))
> ...
> Now why isn't pattern matching lazy by default?  This seems odd for a newbie 
> since everything else is lazy by default.

It's even more confusing that pattern matching in 'let' _is_ lazy.

More information about the Haskell-Cafe mailing list