empty case, empty definitions

C.M.Brown cmb21 at kent.ac.uk
Sat Aug 16 07:38:12 EDT 2008


Hi,


> Sounds bad. Consider:
>
> gray :: Color
> grey = newColor "#ccc"
>
> This fairly common style of bug now becomes perfectly valid Haskell,
> and if you always refer to "grey", you may never even have a clue that
> the bug is present.

I think the compiler should certainly give a warning that no equations are
defined for a definition. It would be impossible to check for user typos!
:)

It does make me beg the question though: why do we want to define
data types without any constructors?

If we do opt for empty data declarations, then both general
pattern matching and case expressions need to be able to cope with it for
consistency.



Regards,
Chris



More information about the Haskell-prime mailing list