Rejig builders for pattern synonyms, especially unlifted ones

Authored by cactus.

Description

Rejig builders for pattern synonyms, especially unlifted ones

When a pattern synonym is for an unlifted pattern, its "builder" would
naturally be a top-level unlifted binding, which isn't allowed. So we
give it an extra Void# argument.

Our Plan A involved then making *two* Ids for these builders, with
some consequential fuss in the desugarer. This was more pain than I
liked, so I've re-jigged it.

  • There is just one builder for a pattern synonym.
  • It may have an extra Void# arg, but this decision is signalled by the Bool in the psBuilder field.

    I did the same for the psMatcher field.

    Both Bools are serialised into interface files, so there is absolutely no doubt whether that extra Void# argument is required.
  • I renamed "wrapper" to "builder". We have too may "wrappers"
  • In order to deal with typecchecking occurrences of P in expressions, I refactored the tcInferId code in TcExpr.

All of this allowed me to revert 5fe872

"Apply compulsory unfoldings during desugaring, except for `seq` which is special."

which turned out to be a rather messy hack in DsBinds

(cherry picked from commit e876208117a34fb58f7f1e470de2f954b3ca303d)

Details