Exhaustive Pattern-Matching

Marcin 'Qrczak' Kowalczyk qrczak@knm.org.pl
Sat, 30 Aug 2003 01:20:42 +0200


Dnia czw 28. sierpnia 2003 16:37, Frank Atanassow napisał:

> SML has the same limitations w.r.t. guards as Haskell; Haskell
> compilers can and do check exhaustiveness, but not redundancy because
> matches are tried sequentially. I believe SML matching is also
> sequential. If there is a difference between the two, it must have to
> do with laziness.

SML doesn't have guards at all.

Most Haskell matches are correctly flagged as non-exhaustive or redundant 
if you use "otherwise" instead of relying on some guards themselves being 
exhaustive (which the compiler can't check).

-- 
   __("<         Marcin Kowalczyk
   \__/       qrczak@knm.org.pl
    ^^     http://qrnik.knm.org.pl/~qrczak/