[ghc-steering-committee] Discussion on #155 Type Variable in Labmdas

Iavor Diatchki iavor.diatchki at gmail.com
Mon Mar 4 19:04:08 UTC 2019


Hello,

> 2. I wonder if supporting type binders in inference mode is as hard as
> > the proposal fears.
> >
> >
> > I think it’s hard.
> >
> >  f @a x = x
> >
> > we could infer any of.
> >
> >  f :: forall a b. b -> b
> >
> >  f :: forall a. a -> a
> >
> >  f :: forall b a. b -> b
>
> I don't know how we'd infer the 2nd option, even though that's surely what
> was intended. There's simply no link between the `a` and `x` in the code.
> So I'd expect GHC to infer either the 1st or 3rd type, and emit a warning
> about the unused type abstraction similar to the existing warnings about
> unused variables or unused foralls. Does the order of tyvars matter here?
> Doesn't seem so, as `b` should be marked inferred, and thus ineligible for
> VTA.
>

Like Eric, I would expect that the type of `f` should be something like (1)
or (3), except that the inferred polymorphic variables should not be
visible (i.e., you shouldn't be able to explicitly apply them), in which
case (1) and (3) are essentially the same:

f :: forall a {b}. b -> b

-Iavor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-steering-committee/attachments/20190304/311e15fa/attachment.html>


More information about the ghc-steering-committee mailing list