Exhaustive Pattern-Matching

Iavor Diatchki diatchki@cse.ogi.edu
Wed, 27 Aug 2003 10:53:34 -0700


hello,

Steffen Mazanek wrote:
> Hello,
> 
> I have a question about pattern-matching. In the Haskell-report it is 
> not postulated, that
> pattern matching has to be exhaustive. Would it be possible at all to 
> implement an
> algorithm, which checks Haskell-style patterns for exhaustiveness? What 
> kinds of
> complication can be expected? Maybe you have some pointers to other 
> resources about
> this topic.
> 
> Thank you,
> Steffen
i believe in general this is undecidable, as one can have arbitrary 
decisions in guards.  of course in practise this is probably not much of 
a problem, so the compiler could (and often does) give useful warnings.
so at the end of the day the usefulness of an algorithm to detect 
incomplete patterns depends on what you want to do with it.

bye
iavor



-- 
==================================================
| Iavor S. Diatchki, Ph.D. student               |
| Department of Computer Science and Engineering |
| School of OGI at OHSU                          |
| http://www.cse.ogi.edu/~diatchki               |
==================================================