Wildcards in type synonyms

ÉRDI Gergő gergo at erdi.hu
Mon Jul 25 10:04:38 UTC 2022


On Mon, 25 Jul 2022, Simon Peyton Jones wrote:

>       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.

I wonder if, instead, I could expand the rhs, typecheck it "abstractly" 
(i.e. in the context of the synonym's binders), and THEN do the 
substitution. If I typecheck the rhs for every occurrence, I should get 
fresh metavars for each wildcard, which is pretty much what I want. I just
have to make sure I don't zonk before the substitution.

Does this make sense?


More information about the ghc-devs mailing list