Preserve user-written types in data declarations
Work in progress on #26246.
In this MR, I am trying to do the following two things:
- When kind-checking a
TyCon, avoid expanding type synonyms. For example, withtype T2T = Type -> Type; type S :: T2T; data S a where {..}, I wanttyConKindto beT2Tand notType -> Type. - When storing
DataCons in interface files, keep the user-written binders; for example indata G a b where { D :: G x y }, I want the type ofDto beforall x y. G x yand notforall a b. G a b.
The main motivation for these changes is Haddock, which gets its information from interface files. However, (1) also improves the :kind output in GHC as it no longer expands type synonyms.
Edited by sheaf