Do we have an existing way of substituting types over type variables, *in
HsType instead of Core Type*?

I'm afraid not. Currently HsType is not processed much -- just renamed and typechecked into a Type.

The nearest we have is Note [Handling overloaded and rebindable constructs], in the renamer.  That doesn't do what you want, but the HsExpansion idea is close

S

On Mon, 25 Jul 2022 at 10:18, ÉRDI Gergő <gergo@erdi.hu> wrote:
On Fri, 22 Jul 2022, Simon Peyton Jones wrote:

>       So it seems that instead of shoehorning it into the existing type
>       synonyms, a better bet would be to branch off to a separate path quite
>       early (maybe as soon as during renaming), expand them during
>       typechecking, and *not* touch how/when existing "normal" type synonyms
>       are resolved.
>
>
> That sounds plausible, yes.

Do we have an existing way of substituting types over type variables, *in
HsType instead of Core Type*?