[Haskell-cafe] Type system trickery

Brent Yorgey byorgey at seas.upenn.edu
Mon Jun 22 12:06:57 EDT 2009


On Sun, Jun 21, 2009 at 09:16:12PM +0100, Andrew Coppin wrote:
> Niklas Broberg wrote:
>> That's what GADTs are for:
>>
>> data Flag = HasZoo | NoZoo
>>
>> data Foobar a where
>>   Foo :: Foobar a -> Foobar a
>>   Bar :: Foobar a -> Foobar a
>>   Zoo :: Foobar a -> Foobar HasZoo
>>   
>
> Ouch #1: This appears to instantly disable deriving the Eq, Ord and Show 
> instances I want. :-/

Ah, yes, that is a pain.  Maybe try playing around with tools like
Data.Derive?  I haven't played with them much myself so I don't know
if they will help.

-Brent


More information about the Haskell-Cafe mailing list