[Haskell-cafe] How odd...

Neil Mitchell ndmitchell at gmail.com
Sat Aug 4 14:53:14 EDT 2007


Hi

If you just use Catch (http://www-users.cs.york.ac.uk/~ndm/catch/):

> >  foo x
> >    | x < 0 = ...
> >    | x == 0 = ...
> >    | x > 0 = ...

This gives an error. Something identical to this code is in
Data.FiniteMap, and indeed, when using floats and NaN's (or just silly
Ord classes) you can cause Data.FiniteMap to pattern match error. See
section 6.3 of the draft paper on the Catch website for details.

>     myNot x
>      | x == True  = False
>      | x == False = True

This is determined to be exhaustive.

> as it is (in general) undecidable whether all patterns are covered.

In general, yes. But its possible to do a lot better than GHC's
current warnings (I'm not saying its worth changing, though)

Thanks

Neil


More information about the Haskell-Cafe mailing list