<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
.MsoPapDefault
        {mso-style-type:export-only;
        margin-top:6.0pt;
        margin-right:0cm;
        margin-bottom:6.0pt;
        margin-left:0cm;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-GB" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D;mso-fareast-language:EN-US">Yes I suspect that patSynSig should return three results: the quantified tyvars, the lhs types and the rhs type<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D;mso-fareast-language:EN-US">Simon<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></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 lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;">From:</span></b><span lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;"> Dr. ÉRDI Gergõ [mailto:gergo@erdi.hu]
<br>
<b>Sent:</b> 20 August 2013 03:09<br>
<b>To:</b> Simon Peyton-Jones<br>
<b>Cc:</b> ghc-devs@haskell.org<br>
<b>Subject:</b> RE: Instantiating a type with fresh, flexi type variables<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p>Hi Simon,<o:p></o:p></p>
<p>Here's what I wrote earlier about this to someone who contacted me in private (name withheld because I don't know why he contacted me off-list):<o:p></o:p></p>
<p>&quot;&quot;&quot;<br>
So the code in question is this:<br>
<a href="https://github.com/gergoerdi/ghc/commit/f874f8#L5R749">https://github.com/gergoerdi/ghc/commit/f874f8#L5R749</a><o:p></o:p></p>
<p>and the part that feels fishy to me is tcInstTypes, both the implementation and the fact that I have to take care of this manually. I guess the right solution would involve doing something differently in<br>
<a href="https://github.com/gergoerdi/ghc/commit/244b9#L3R43">https://github.com/gergoerdi/ghc/commit/244b9#L3R43</a><br>
so that the types in &quot;rhs_ty&quot; and &quot;args&quot; are correctly generalized. But I haven't been able to find out how that would be done.<br>
&quot;&quot;&quot;<o:p></o:p></p>
<p>I'm replying to your other questions in a separate, private mail.<o:p></o:p></p>
<p>Thanks,<br>
Gergo<o:p></o:p></p>
<div>
<p class="MsoNormal">On Aug 20, 2013 6:14 AM, &quot;Simon Peyton-Jones&quot; &lt;<a href="mailto:simonpj@microsoft.com">simonpj@microsoft.com</a>&gt; wrote:<o:p></o:p></p>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<p class="MsoNormal" style="margin-bottom:12.0pt">I'm a bit puzzled that you don't have a *quantified* type, something like<br>
&nbsp; &nbsp; &nbsp; &nbsp; forall abc. &nbsp;ty1 -&gt; ... -&gt; tyn -&gt; ty<br>
to instantiate. I'm a bit suspicious about instantiating all the random free variables of a type (or types). We should talk now I'm back in circulation. &nbsp; What time zone are &nbsp;you in? &nbsp;What's your skype id? (Mine is simonpj0)<br>
<br>
simon<br>
<br>
| &nbsp;-----Original Message-----<br>
| &nbsp;From: ghc-devs [mailto:<a href="mailto:ghc-devs-bounces@haskell.org">ghc-devs-bounces@haskell.org</a>] On Behalf Of Dr. ERDI<br>
| &nbsp;Gergo<br>
| &nbsp;Sent: 08 August 2013 18:37<br>
| &nbsp;To: <a href="mailto:ghc-devs@haskell.org">ghc-devs@haskell.org</a><br>
| &nbsp;Subject: Instantiating a type with fresh, flexi type variables<br>
|<br>
| &nbsp;For my pattern-synonyms branch (see prev. email) I had to write the<br>
| &nbsp;following function, incl. making TcValidity.fvTypes public:<br>
|<br>
| &nbsp;tcInstTypes :: [TcType] -&gt; TcM [TcType]<br>
| &nbsp;tcInstTypes tys<br>
| &nbsp; &nbsp; = do { let tvs = fvTypes tys<br>
| &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;; (_, _, subst) &lt;- tcInstTyVars tvs<br>
| &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;; return $ map (substTy subst) tys }<br>
|<br>
| &nbsp;I'm surprised I had to write this myself, and this made me wonder if<br>
| &nbsp;there's a much better way to handle cases where I have some kind of<br>
| &nbsp;definition which has some inferred type, and then various use sites<br>
| &nbsp;of that definition must all have types that can be unified with this<br>
| &nbsp;original inferred type.<br>
| &nbsp;Is there?<br>
|<br>
| &nbsp;Thanks,<br>
| &nbsp; &nbsp; &nbsp; Gergo<br>
|<br>
| &nbsp;_______________________________________________<br>
| &nbsp;ghc-devs mailing list<br>
| &nbsp;<a href="mailto:ghc-devs@haskell.org">ghc-devs@haskell.org</a><br>
| &nbsp;<a href="http://www.haskell.org/mailman/listinfo/ghc-devs" target="_blank">http://www.haskell.org/mailman/listinfo/ghc-devs</a><o:p></o:p></p>
</blockquote>
</div>
</div>
</div>
</body>
</html>