interaction of GADTs and data families: a bug?

Sittampalam, Ganesh ganesh.sittampalam at
Thu Apr 15 09:44:55 EDT 2010

Sebastian Fischer wrote:
>> With GADTs, the specific choice of constructor is what gives you the
>> type matching functionality.
> My intention was to use a GADT as data family instance (hence, I
> wrote it in GADT style and it was accepted as such). Can't GADTs be
> used as data family instances?  

I'm not aware of any restriction there, but that's not the issue here.

You were trying to choose between different top-level types (which
happen to be instances of the same family) by their constructors. GADTs
allow you to choose between different constructors of the *same*
top-level type.

If DataFam Bool had multiple constructors, you could choose between them
in fffuuuu. But fffuuuu would have to have type DataFam Bool -> Bool ->
Int (as is necessary with your originally posted code).


Please access the attached hyperlink for an important electronic communications disclaimer: 

More information about the Glasgow-haskell-users mailing list