patch applied (ghc): isDataTyCon should be False for all type families, even data type families

Manuel M T Chakravarty chak at cse.unsw.edu.au
Sun May 6 04:35:09 EDT 2007


Simon,

> Fri May  4 04:03:01 PDT 2007  simonpj at microsoft.com
>   * isDataTyCon should be False for all type families, even data type families
>   
>   isDataTyCon advertises that it's true of "data types that are
>   definitely represented by heap-allocated constructors.  These are
>   srcutinised by Core-level @case@ expressions, and they get info tables
>   allocated for them."
>   
>   Type-family TyCons never have this property, not even data type families.
>   It's the *instance* TyCons that do.
>   
>   I hope that this change does not break anything that somehow relied
>   on the old (wrong) semantics.

It breaks every program with data families.  See Bug #1331, which Igloo 
just opened:

   http://hackage.haskell.org/trac/ghc/ticket/1331

I am not sure whether the "wrongKindOfFamily" test is the only place 
where things break, there may well be other places.  However, as far as 
"wrongKindOfFamily" is concerned, the use of isDataTyCon is to 
distinguish "data family" declarations from "newtype families" (which 
"isAlgTyCon" doesn't do).  Roman, raised the question of whether we 
actually would want to permit newtype instances for data families (or in 
other words whether it makes sense to distinguish between data families 
and newtype families at all - it surely makes sense to distinguish 
between data instances and newtype instances, though).  What do you 
think?  If we are to allow newtype instances for data families, do we 
still want to support the declaration of "newtype families" (and what 
does it mean to be a newtype family)?

Manuel



More information about the Cvs-ghc mailing list