A Pointless Library Proposal

Ben Rudiak-Gould Benjamin.Rudiak-Gould at cl.cam.ac.uk
Mon Oct 30 09:12:38 EST 2006


Ashley Yakeley wrote:
>   data MyGADT a where
>     MyInt :: MyGADT Int
>     MyChar :: MyGADT Char
> 
>   never :: MyGADT Bool -> a
> 
> Annoyingly, this doesn't compile without adding a definition line 
> mentioning a bottom value.

This can't be fixed because the desugaring is ambiguous. never might be _|_ 
or \x. _|_ or \x y. _|_ or ...

How about

   never :: MyGADT Bool -> a
   never x = case x of {}

which is just the desugared form of your intended empty definition? GHC 
doesn't allow it, but it would be a simple extension.

-- Ben



More information about the Libraries mailing list