On a more inane front, does this give a path to either making $ less magical, or better user facing errors when folks use compose (.) style code instead and hit impredicativtity issues that $ magic would have handled ?<span></span><br><br>On Sunday, October 2, 2016, Ganesh Sittampalam <<a href="mailto:ganesh@earth.li">ganesh@earth.li</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div>Elsewhere in the thread, you said<br>
<br>
<blockquote type="cite">
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:12.0pt;margin-left:36.0pt"><span style="font-family:"Arial",sans-serif">1)
ImpredicativeTypes enables types like `Maybe (forall a. a)`.
Do those just disappear, or are they also enabled anyway? (I
would guess the former.)<u></u><u></u></span></p>
<span style="font-family:"Calibri",sans-serif">Yes,
they’d disappear.</span></blockquote>
<br>
but here you're talking about 'xs :: [forall a . a->a]' being
possible with VTA - is the idea that such types will be possible
but only with both explicit signatures and VTA?<br>
<br>
On 30/09/2016 16:29, Simon Peyton Jones via ghc-devs wrote:<br>
</div>
<blockquote type="cite">
<div>
<p class="MsoNormal"><span style="font-family:"Calibri",sans-serif">Alejandro:
excellent point. I mis-spoke before. In my proposal we WILL
allow types like (Tree (forall a. a->a)).<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri",sans-serif"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri",sans-serif">I’m
trying to get round to writing a proposal (would someone
else like to write it – it should be short), but the idea is
this:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri",sans-serif"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-left:18.0pt"><b><span style="font-family:"Calibri",sans-serif">When
you have -XImpredicativeTypes<u></u><u></u></span></b></p>
<p style="margin-left:54.0pt">
<span style="font-family:Symbol"><span>·<span style="font:7.0pt "Times New Roman"">
</span></span></span><b><span style="font-family:"Calibri",sans-serif">You
can write a polytype in a visible type argument; eg. f
@(forall a. a->a)<u></u><u></u></span></b></p>
<p style="margin-left:54.0pt">
<span style="font-family:Symbol"><span>·<span style="font:7.0pt "Times New Roman"">
</span></span></span><b><span style="font-family:"Calibri",sans-serif">You
can write a polytype as an argument of a type in a
signature e.g. f :: [forall a. a->a] -> Int<u></u><u></u></span></b></p>
<p class="MsoNormal" style="margin-left:18.0pt"><b><span style="font-family:"Calibri",sans-serif"><u></u> <u></u></span></b></p>
<p class="MsoNormal" style="margin-left:18.0pt"><b><span style="font-family:"Calibri",sans-serif">And
that’s all. A unification variable STILL CANNOT be
unified with a polytype. The only way you can call a
polymorphic function at a polytype is to use Visible Type
Application.<u></u><u></u></span></b></p>
<p class="MsoNormal" style="margin-left:18.0pt"><b><span style="font-family:"Calibri",sans-serif"><u></u> <u></u></span></b></p>
<p class="MsoNormal" style="margin-left:18.0pt"><b><span style="font-family:"Calibri",sans-serif">So
using impredicative types might be tiresome. E.g.<u></u><u></u></span></b></p>
<p style="margin-left:54.0pt"><b><span> type SID = forall a.
a->a<u></u><u></u></span></b></p>
<p style="margin-left:54.0pt"><b><span><u></u> <u></u></span></b></p>
<p style="margin-left:54.0pt"><b><span> xs :: [forall a.
a->a]<u></u><u></u></span></b></p>
<p style="margin-left:54.0pt"><b><span> xs = (:) @SID id (
(:) @SID id ([] @ SID))<u></u><u></u></span></b></p>
<p class="MsoNormal" style="margin-left:18.0pt"><b><span style="font-family:"Calibri",sans-serif"><u></u> <u></u></span></b></p>
<p class="MsoNormal" style="margin-left:18.0pt"><b><span style="font-family:"Calibri",sans-serif">In
short, if you call a function at a polytype, you must use
VTA. Simple, easy, predictable; and doubtless annoying.
But possible</span></b><span style="font-family:"Calibri",sans-serif">.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri",sans-serif"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri",sans-serif">Simon<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri",sans-serif"><u></u> <u></u></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #e1e1e1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" lang="EN-US">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" lang="EN-US"> Alejandro Serrano Mena
[<a href="javascript:_e(%7B%7D,'cvml','trupill@gmail.com');" target="_blank">mailto:trupill@gmail.com</a>]
<br>
<b>Sent:</b> 26 September 2016 08:13<br>
<b>To:</b> Simon Peyton Jones
<a href="javascript:_e(%7B%7D,'cvml','simonpj@microsoft.com');" target="_blank"><simonpj@microsoft.com></a><br>
<b>Cc:</b> <a href="javascript:_e(%7B%7D,'cvml','ghc-users@haskell.org');" target="_blank">ghc-users@haskell.org</a>; <a href="javascript:_e(%7B%7D,'cvml','ghc-devs@haskell.org');" target="_blank">ghc-devs@haskell.org</a><br>
<b>Subject:</b> Re: Getting rid of
-XImpredicativeTypes<u></u><u></u></span></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:12.0pt;margin-left:0cm">What
would be the story for the types of the arguments.
Would I be allowed to write the following?<u></u><u></u></p>
</div>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:12.0pt;margin-left:0cm">>
f (lst :: [forall a. a -> a]) = head @(forall a. a
-> a) lst 3<u></u><u></u></p>
</div>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">Regards,<u></u><u></u></p>
</div>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">Alejandro<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm"><u></u> <u></u></p>
<div>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">2016-09-25
20:05 GMT+02:00 Simon Peyton Jones via ghc-devs <<a href="javascript:_e(%7B%7D,'cvml','ghc-devs@haskell.org');" target="_blank">ghc-devs@haskell.org</a>>:<u></u><u></u></p>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<div>
<div>
<p class="MsoNormal">Friends<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">GHC
has a flag -XImpredicativeTypes that makes a
half-hearted attempt to support impredicative
polymorphism. But it is vestigial…. if it works,
it’s really a fluke. We don’t really have a
systematic story here at all.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">I
propose, therefore, to remove it entirely. That
is, if you use -XImpredicativeTypes, you’ll get a
warning that it does nothing (ie. complete no-op)
and you should remove it.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Before
I pull the trigger, does anyone think they are
using it in a mission-critical way?<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Now
that we have Visible Type Application there is a
workaround: if you want to call a polymorphic
function at a polymorphic type, you can explicitly
apply it to that type. For example:<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p>{-# LANGUAGE ImpredicativeTypes,
TypeApplications, RankNTypes #-}<u></u><u></u></p>
<p>module Vta where<u></u><u></u></p>
<p> f x = id @(forall a. a->a) id @Int x<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">You
can also leave out the @Int part of course.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Currently
we have to use -XImpredicativeTypes to allow the
@(forall a. a->a). Is that sensible? Or
should we allow it regardless? I rather think
the latter… if you have Visible Type Application
(i.e. -XTypeApplications) then applying to a
polytype is nothing special. So I propose to
lift that restriction.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">I
should go through the GHC Proposals Process for
this, but I’m on a plane, so I’m going to at least
start with an email.<u></u><u></u></p>
<p class="MsoNormal"><span style="color:#888888"> <u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:#888888">Simon<u></u><u></u></span></p>
</div>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
______________________________<wbr>_________________<br>
ghc-devs mailing list<br>
<a href="javascript:_e(%7B%7D,'cvml','ghc-devs@haskell.org');" target="_blank">ghc-devs@haskell.org</a><br>
<a href="https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmail.haskell.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fghc-devs&data=01%7C01%7Csimonpj%40microsoft.com%7Cd4eb1fd61d0148cea9f508d3e5dca6fe%7C72f988bf86f141af91ab2d7cd011db47%7C1&sdata=ZM3djztmpA09J6x1DmmV0LEeftsA1FhjPhjwLuG5w%2FE%3D&reserved=0" target="_blank">http://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/ghc-devs</a><u></u><u></u></p>
</blockquote>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
</div>
<br>
<fieldset></fieldset>
<br>
<pre>______________________________<wbr>_________________
ghc-devs mailing list
<a href="javascript:_e(%7B%7D,'cvml','ghc-devs@haskell.org');" target="_blank">ghc-devs@haskell.org</a>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs" target="_blank">http://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/ghc-devs</a>
</pre>
</blockquote>
<p><br>
</p>
</div>
</blockquote>