Skip to content

Rename RecordPuns to NamedFieldPuns in LangExt.Extension

Alfredo Di Napoli requested to merge wip/adinapoli-rename-recordfields into master

This is an exploratory MR that stemmed from my work on #18516 and which was later discussed (briefly) on the ghc-dev mailing list. See https://mail.haskell.org/pipermail/ghc-devs/2021-July/020048.html

Feel free to close it if you think the drawbacks outscores the "gains".

In a nutshell, this MR renames the RecordPuns type constructor inside GHC.LanguageExtensions.Type.hs to NamedFieldPuns, and uses a pattern synonym to retain backward compatibility. The rationale is that the RecordPuns language extension was deprecated a long time ago, but it was still present in the AST, introducing an annoying mismatch between what GHC suggested (i.e. "use NamedFieldPuns") and what that translated into in terms of Haskell types.

I think the end result is nice -- the cleanup is not massive but it surely helps a bit in a few places of the codebase and it gets rid of an annoying outliner in GHC.Types.Hint.Ppr. The only downside is that the COMPLETE pragma I have added is big and it will grow which every new extension we add. On the plus side, I was able to place a DEPRECATED pragma on the pattern synonym, which hopefully will warn the working GHC hacker about the fact RecordPuns should not be used anymore. Credits to @edsko for suggesting the use of DEPRECATED here.

Edited by Alfredo Di Napoli

Merge request reports