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! **
Showing
- compiler/basicTypes/DataCon.lhs 7 additions, 23 deletionscompiler/basicTypes/DataCon.lhs
- compiler/basicTypes/MkId.lhs 32 additions, 18 deletionscompiler/basicTypes/MkId.lhs
- compiler/basicTypes/OccName.lhs 24 additions, 3 deletionscompiler/basicTypes/OccName.lhs
- compiler/iface/BinIface.hs 2 additions, 4 deletionscompiler/iface/BinIface.hs
- compiler/iface/BuildTyCl.lhs 51 additions, 23 deletionscompiler/iface/BuildTyCl.lhs
- compiler/iface/IfaceSyn.lhs 18 additions, 14 deletionscompiler/iface/IfaceSyn.lhs
- compiler/iface/MkIface.lhs 9 additions, 7 deletionscompiler/iface/MkIface.lhs
- compiler/iface/TcIface.lhs 11 additions, 14 deletionscompiler/iface/TcIface.lhs
- compiler/prelude/TysWiredIn.lhs 0 additions, 1 deletioncompiler/prelude/TysWiredIn.lhs
- compiler/typecheck/TcTyClsDecls.lhs 7 additions, 11 deletionscompiler/typecheck/TcTyClsDecls.lhs
- compiler/types/Coercion.lhs 26 additions, 2 deletionscompiler/types/Coercion.lhs
- compiler/types/TyCon.lhs 33 additions, 10 deletionscompiler/types/TyCon.lhs
Loading
Please register or sign in to comment