Skip to content

Implement proposal 106 - Define Kinds Without Promotion

Ross Paterson requested to merge RossPaterson/ghc:wip/type-data into master

This patch implements proposal #106 (TypeData - Define Kinds Without Promotion).

The main points are:

  • compiler/Language/Haskell/Syntax/Decls.hs: Add a Boolean field dd_type to HsDataDefn to mark data type definitions.
  • compiler/GHC/Parser/PostProcess.hs: In mkDataDefn, promote the names of constructors in such declarations from DataName to TcClsName.
  • compiler/GHC/Types/TyThing.hs: In implicitTyConThings, if the constructor name is a TcClsName, just return the promoted type constructor instead of the data constructor stuff.
  • compiler/GHC/Rename/Module.hs: Check most restrictions on type data declarations in check_type_data called from rnDataDefn.
  • compiler/GHC/Tc/TyCl.hs: Check restrictions on constraints on constructor types in checkValidDataCon.

The changes to HsDataDefn require a matching merge request to Haddock (haddock!15 (merged)) to be applied simultaneously.

It also needs DataType to be added to Cabal, but I couldn't find how to make a merge request for that.

Edited by Ross Paterson

Merge request reports