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

C.M.Brown cmb21 at kent.ac.uk
Wed Sep 19 09:11:49 EDT 2007

> It seems GHC does give a warning at compile-time about it, so you did
> get it right the first time :-)

Well the warning happens at compile time certainly. But the irrefutable
pattern error only occurs at runtime.

cmb21$ ghc --make Main.hs
[1 of 1] Compiling Main             ( Main.hs, Main.o )

    Warning: Pattern match(es) are overlapped
             In the definition of `f': f ~[] = ...
Linking Main ...

cmb21$ ./a.out
a.out: Main.hs:(3,0)-(4,10): Irrefutable pattern failed for pattern (x :


> Thanks for the info,
> Peter

More information about the Haskell-Cafe mailing list