<div dir="ltr"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span>So it’s not just a question of saying “just add that paper to GHC and voila job done”.</span> </blockquote><div><br></div><div>Of course not. The same was true for QuickLook, though, wasn't it?<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Sep 2, 2021 at 12:42 PM Simon Peyton Jones <<a href="mailto:simonpj@microsoft.com">simonpj@microsoft.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">





<div style="overflow-wrap: break-word;" lang="EN-GB">
<div class="gmail-m_5552570779404930055WordSection1">
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:6pt;margin-left:36pt">
If I understand correctly, the recent ICFP paper "<a href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdl.acm.org%2Fdoi%2Fpdf%2F10.1145%2F3473569&data=04%7C01%7Csimonpj%40microsoft.com%7Caee2e0a922204ae3611208d96e2c2c57%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637661959634445057%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=wsN3Z7t8jCiExzl38%2F2IwNNsPH3Pq5CHJ7dQca5R2Y4%3D&reserved=0" target="_blank">An
 Existential Crisis Resolved</a>" finally enables this; is that right?<u></u><u></u></p>
<p class="MsoNormal"><span>It describes one way to include existentials in GHC’s intermediate language, which is a real contribution.
<i>But it is not a small change</i>.  So it’s not just a question of saying “just add that paper to GHC and voila job done”.<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span>Simon<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<div style="border-color:currentcolor currentcolor currentcolor blue;border-style:none none none solid;border-width:medium medium medium 1.5pt;padding:0cm 0cm 0cm 4pt">
<div>
<div style="border-color:rgb(225,225,225) currentcolor currentcolor;border-style:solid none none;border-width:1pt medium medium;padding:3pt 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> Alex Rozenshteyn <<a href="mailto:rpglover64@gmail.com" target="_blank">rpglover64@gmail.com</a>>
<br>
<b>Sent:</b> 02 September 2021 17:10<br>
<b>To:</b> Simon Peyton Jones <<a href="mailto:simonpj@microsoft.com" target="_blank">simonpj@microsoft.com</a>><br>
<b>Cc:</b> GHC developers <<a href="mailto:ghc-devs@haskell.org" target="_blank">ghc-devs@haskell.org</a>><br>
<b>Subject:</b> Re: New implementation for `ImpredicativeTypes`<u></u><u></u></span></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:6pt;margin-left:0cm">
If I understand correctly, the recent ICFP paper "<a href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdl.acm.org%2Fdoi%2Fpdf%2F10.1145%2F3473569&data=04%7C01%7Csimonpj%40microsoft.com%7Caee2e0a922204ae3611208d96e2c2c57%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637661959634445057%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=wsN3Z7t8jCiExzl38%2F2IwNNsPH3Pq5CHJ7dQca5R2Y4%3D&reserved=0" target="_blank">An
 Existential Crisis Resolved</a>" finally enables this; is that right?<u></u><u></u></p>
</div>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:6pt;margin-left:0cm">
<u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:6pt;margin-left:0cm">
On Mon, Sep 9, 2019 at 12:00 PM Simon Peyton Jones <<a href="mailto:simonpj@microsoft.com" target="_blank">simonpj@microsoft.com</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border-color:currentcolor currentcolor currentcolor rgb(204,204,204);border-style:none none none solid;border-width:medium medium medium 1pt;padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm">
<div>
<div>
<p class="MsoNormal" style="margin-left:36pt">
Suppose Haskell <i>did</i> have existentials;<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Yes, I think that’s an interesting thing to work on!  I’m not sure what the implications would be.  At very least we’d need to extend System FC (GHC’s intermediate language) with
 existential types and the corresponding pack and unpack syntactic forms.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">I don’t know of any work studying that question specifically, but others may have pointers.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">simon<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<div style="border-style:none none none solid;border-width:medium medium medium 1.5pt;padding:0cm 0cm 0cm 4pt;border-color:currentcolor currentcolor currentcolor blue">
<div>
<div style="border-style:solid none none;border-width:1pt medium medium;padding:3pt 0cm 0cm;border-color:currentcolor">
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> Alex Rozenshteyn <<a href="mailto:rpglover64@gmail.com" target="_blank">rpglover64@gmail.com</a>>
<br>
<b>Sent:</b> 06 September 2019 15:21<br>
<b>To:</b> Simon Peyton Jones <<a href="mailto:simonpj@microsoft.com" target="_blank">simonpj@microsoft.com</a>><br>
<b>Cc:</b> Alejandro Serrano Mena <<a href="mailto:trupill@gmail.com" target="_blank">trupill@gmail.com</a>>; GHC developers <<a href="mailto:ghc-devs@haskell.org" target="_blank">ghc-devs@haskell.org</a>><br>
<b>Subject:</b> Re: New implementation for `ImpredicativeTypes`</span><u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:6pt">Hi Simon,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:6pt"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:6pt">You're exactly right, of course. My example is confusing, so let me see if I can clarify.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:6pt"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:6pt">What I want in the ideal is
<code><span style="font-size:10pt">map show [1, 'a', "b"]</span></code>. That is, minimal syntactic overhead to mapping a function over multiple values of distinct types that results in a homogeneous list. As the reddit thread points out, there are workarounds
 involving TH or wrapping each element in a constructor or using bespoke operators, but when it comes down to it, none of them actually allows me to say what I
<i>mean</i>; the TH one is closest, but I reach for TH only in times of desperation.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:6pt"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:6pt">I had thought that one of the things preventing this was lack of impredicative instantiation, but now I'm not sure. Suppose Haskell
<i>did</i> have existentials; would <code><span style="font-size:10pt">map show @(exists a. Show a => a) [1, 'a', "b"]</span></code> work in current Haskell and/or in quick-look?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:6pt"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:6pt">Tangentially, do you have a reference for what difficulties arise in adding existentials to Haskell? I have a feeling that it would make working with GADTs more ergonomic.<u></u><u></u></p>
</div>
</div>
<p class="MsoNormal" style="margin-bottom:6pt"> <u></u><u></u></p>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:6pt">On Fri, Sep 6, 2019 at 12:33 AM Simon Peyton Jones <<a href="mailto:simonpj@microsoft.com" target="_blank">simonpj@microsoft.com</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border-style:none none none solid;border-width:medium medium medium 1pt;padding:0cm 0cm 0cm 6pt;margin:5pt 0cm 5pt 4.8pt;border-color:currentcolor currentcolor currentcolor rgb(204,204,204)">
<div>
<div>
<p class="MsoNormal">I’m confused.   Char does not have the type (forall a. Show a =>a), so our example is iill-typed in System F, never mind about type inference.  Perhaps there’s a typo?   I think
 you may have ment<u></u><u></u></p>
<p class="MsoNormal">               exists a. Show a => a<u></u><u></u></p>
<p class="MsoNormal">which doesn’t exist in Haskell.  You can write existentials with a data type<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">data Showable where<u></u><u></u></p>
<p class="MsoNormal">   S :: forall a. Show a => a -> Showable<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Then<u></u><u></u></p>
<p class="MsoNormal">               map show [S 1, S ‘a’, S “b”]<u></u><u></u></p>
<p class="MsoNormal">works fine today (without our new stuff), provided you say<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">               instance Show Showable where<u></u><u></u></p>
<p class="MsoNormal">                 show (S x) = show x<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Our new system can only type programs that can be written in System F.   (The tricky bit is inferring the impredicative instantiations.)<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Simon<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<div style="border-style:none none none solid;border-width:medium medium medium 1.5pt;padding:0cm 0cm 0cm 4pt;border-color:currentcolor currentcolor currentcolor blue">
<div>
<div style="border-style:solid none none;border-width:1pt medium medium;padding:3pt 0cm 0cm;border-color:currentcolor">
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> ghc-devs <<a href="mailto:ghc-devs-bounces@haskell.org" target="_blank">ghc-devs-bounces@haskell.org</a>>
<b>On Behalf Of </b>Alex Rozenshteyn<br>
<b>Sent:</b> 06 September 2019 03:31<br>
<b>To:</b> Alejandro Serrano Mena <<a href="mailto:trupill@gmail.com" target="_blank">trupill@gmail.com</a>><br>
<b>Cc:</b> GHC developers <<a href="mailto:ghc-devs@haskell.org" target="_blank">ghc-devs@haskell.org</a>><br>
<b>Subject:</b> Re: New implementation for `ImpredicativeTypes`</span><u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:6pt">I didn't say anything when you were requesting use cases, so I have no right to complain, but I'm still a little disappointed that this doesn't fix my (admittedly very minor) issue:
<a href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.reddit.com%2Fr%2Fhaskell%2Fcomments%2F3am0qa%2Fexistentials_and_the_heterogenous_list_fallacy%2Fcsdwlp2%2F%3Fcontext%3D8%26depth%3D9&data=04%7C01%7Csimonpj%40microsoft.com%7Caee2e0a922204ae3611208d96e2c2c57%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637661959634445057%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=HEn92VgTK3lOrYywm7gml4kn%2BYRreZXxtCKvLib805g%3D&reserved=0" target="_blank">
https://www.reddit.com/r/haskell/comments/3am0qa/existentials_and_the_heterogenous_list_fallacy/csdwlp2/?context=8&depth=9</a><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:6pt"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:6pt">For those who don't want to click on the reddit link: I would like to be able to write something like<code><span style="font-size:10pt"> map show ([1, 'a', "b"] :: [forall a. Show a
 => a])</span></code><code><span style="font-size:10pt;font-family:"Arial",sans-serif">, and have it work.</span></code><u></u><u></u></p>
</div>
</div>
<p class="MsoNormal" style="margin-bottom:6pt"> <u></u><u></u></p>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:6pt">On Wed, Sep 4, 2019 at 8:13 AM Alejandro Serrano Mena <<a href="mailto:trupill@gmail.com" target="_blank">trupill@gmail.com</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border-style:none none none solid;border-width:medium medium medium 1pt;padding:0cm 0cm 0cm 6pt;margin:5pt 0cm 5pt 4.8pt;border-color:currentcolor currentcolor currentcolor rgb(204,204,204)">
<div>
<div>
<p class="MsoNormal" style="margin-bottom:6pt">Hi all,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:6pt">As I mentioned some time ago, we have been busy working on a new implementation of `ImpredicativeTypes` for GHC. I am very thankful to everybody who back then sent us examples of impredicativity
 which would be nice to support, as far as we know this branch supports all of them! :)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:6pt"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:6pt">If you want to try it, at
<a href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.haskell.org%2Ftrupill%2Fghc%2Fcommit%2Fa3f95a0fe0f647702fd7225fa719a8062a4cc0a5%2Fpipelines%3Fref%3Dquick-look-build&data=04%7C01%7Csimonpj%40microsoft.com%7Caee2e0a922204ae3611208d96e2c2c57%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637661959634455057%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=v5%2BPdW%2Fcx2OXNiIrQ8Dsa45rUgh1CRr6ERNzxbihxoA%3D&reserved=0" target="_blank">
https://gitlab.haskell.org/trupill/ghc/commit/a3f95a0fe0f647702fd7225fa719a8062a4cc0a5/pipelines?ref=quick-look-build</a> you can find the result of the pipeline, which includes builds for several platforms (click on the "Artifacts" button, the one which looks
 like a cloud, to get them). The code is being developed at <a href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.haskell.org%2Ftrupill%2Fghc&data=04%7C01%7Csimonpj%40microsoft.com%7Caee2e0a922204ae3611208d96e2c2c57%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637661959634465051%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=pFQzrPCiZXF0Y3KqmxjlhrDX1EVddJqII%2B%2BPTJb65h8%3D&reserved=0" target="_blank">
https://gitlab.haskell.org/trupill/ghc</a>.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:6pt"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:6pt">Any code should run *unchanged* except for some eta-expansion required for some specific usage patterns of higher-rank types. Please don't hesitate to ask any questions or clarifications
 about it. A merge request for tracking this can be found at <a href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.haskell.org%2Fghc%2Fghc%2Fmerge_requests%2F1659&data=04%7C01%7Csimonpj%40microsoft.com%7Caee2e0a922204ae3611208d96e2c2c57%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637661959634475049%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=j0JcM0Q%2Bj7JSSb6lV%2F6Aj4lAZWjAysg%2FHg5cb4x00%2FY%3D&reserved=0" target="_blank">
https://gitlab.haskell.org/ghc/ghc/merge_requests/1659</a><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:6pt"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:6pt">Kind regards,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:6pt">Alejandro<u></u><u></u></p>
</div>
</div>
<p class="MsoNormal" style="margin-bottom:6pt">_______________________________________________<br>
ghc-devs mailing list<br>
<a href="mailto:ghc-devs@haskell.org" target="_blank">ghc-devs@haskell.org</a><br>
<a href="https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmail.haskell.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fghc-devs&data=04%7C01%7Csimonpj%40microsoft.com%7Caee2e0a922204ae3611208d96e2c2c57%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637661959634485038%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=9i55zUcM%2BX%2FN7ngvTARBOvfm962IJ9SYfxfa46f7wm8%3D&reserved=0" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs</a><u></u><u></u></p>
</blockquote>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>

</blockquote></div>