Types should be pretty printed as types, not via IfaceType
Quite a long time ago there were two pretty printers, one for Types and one for IfaceTypes. These were then combined so that Types are converted to IfaceTypes and then printed out.
- Benefit: There is less code.
However, there are some downsides to this approach
- Drawback: It is not very modular, because now types purporting to just be to do with interfaces have to know about user pretty printing flags and other details to do with pretty printing. For example see
IfaceFreeTyVar
inIfaceType
, just an artifact of the pretty printing. - Drawback: Information gets accidentally serialised to interface files which bloats interface files (see #24563)
If we are going to take steps to reduce interface file size then it is very important to be very very clear about what is going into interface files. Therefore I think we should revert this change and go back to having two pretty printers. One which prints Type
for users and error messages, and a simpler on which prints IfaceType
for debugging.