Introduce coercions for data instance decls
Mon Sep 18 19:07:30 EDT 2006 Manuel M T Chakravarty <chak@cse.unsw.edu.au>
* Introduce coercions for data instance decls
Tue Aug 22 20:33:46 EDT 2006 Manuel M T Chakravarty <chak@cse.unsw.edu.au>
* Introduce coercions for data instance decls
- data instance declarations implicitly generate a coercion moving between the
representation type and family instance type.
- The coercion is *implicitly* generated when type checking both source and
ifaces. Ie, we don't safe it in ifaces - this is really exactly as newtype
coercions are handled.
- The previous addition of the instance types to DataCons has been moved to
the representation TyCon. This is more efficient as it is shared between all
constructors of one representation tycon and it also gathers everything about
data instances (family tycon, instance types, and coercion) in one place: the
algTcParent field of TyCon.
- The coercion is already used in the datacon wrappers, but not yet during type
checking pattern matching of indexed data types.
- The code has only been lightly tested, but doesn't seem to break features not
related to indexed types. For indexed data types only the pattern matching
tc code (in TcPat.tcConPat) and some well-formedness checks are still
missing. And there will surely be some bugs to fix. (newtypes still require
some more work.)
** WARNING: Interface file format changed! **
** Recompile from scratch! **
12 files changed: