[Haskell-cafe] TypeApplications and Proxy
Richard Eisenberg
rae at richarde.dev
Mon Sep 14 22:04:45 UTC 2020
I would say that TypeApplications is stable enough, and that the ordering of type variables is reliable enough.
But, sadly, we can't quite get rid of Proxy yet. Here's a very contrived example:
type family F a
hr :: (forall a. F a -> ()) -> ()
hr _ = ()
x = hr (\ _ -> ())
In the body of the lambda there, it is impossible to bind the type variable `a` with any Haskell construct. The workaround is to use Proxy in the type of hr. I don't know another way to do it.
So I'm all for removing other uses of Proxy, but I don't think we should quite drop it from base, yet.
Proposal #155 (https://github.com/ghc-proposals/ghc-proposals/pull/155) is in this area, but it's not yet implemented.
Richard
> On Sep 14, 2020, at 3:34 PM, Johannes Waldmann <johannes.waldmann at htwk-leipzig.de> wrote:
>
>
>> TypeApplication depends on the
>> order in which type variables are introduced.
>
> https://downloads.haskell.org/ghc/latest/docs/html/users_guide/glasgow_exts.html#ordering-of-specified-variables
>
> The easy fix is to declare all type variables.
> Then the first clause of 9.19.2 is enough?
>
> - J.
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
More information about the Haskell-Cafe
mailing list