Skip to content

T2T in Expressions (#23738)

Vladislav Zavialov requested to merge wip/int-index/t2t-expr into master

This patch implements the T2T (term-to-type) transformation in expressions, as described in #23738 (closed).

Given a function with a required type argument

vfun :: forall a -> ...

the user can now call it as

vfun (Maybe Int)

instead of

vfun (type (Maybe Int))

The Maybe Int argument is parsed and renamed as a term (HsExpr), but then undergoes a conversion to a type (HsType). See the new function expr_to_type in compiler/GHC/Tc/Gen/App.hs and Note [RequiredTypeArguments and the T2T mapping]

Left as future work: checking for puns.

Edited by Vladislav Zavialov

Merge request reports