"case" of an empty type should have no branches

Roman Beslik beroal at ukr.net
Sun Oct 9 18:00:43 CEST 2011


On 09.10.11 15:45, Felipe Almeida Lessa wrote:
> On Sun, Oct 9, 2011 at 8:26 AM, Roman Beslik<beroal at ukr.net>  wrote:
>> Why the following code does not work?
>>> data Empty
>>> quodlibet :: Empty ->  a
>>> quodlibet x = case x of
>> "parse error (possibly incorrect indentation)"
> Works for me:
>
>    data Empty
>
>    quodlibet :: Empty ->  a
>    quodlibet x = case x of _ ->  undefined
This is a solution. Thanks.

> I'd prefer to define something like
>
>    data Finite = Zero | Plus Finite
>
You just defined the set of natural numbers which is infinite. ;)



More information about the Glasgow-haskell-users mailing list