<br><br><div class="gmail_quote">On Thu, Jul 16, 2009 at 12:40 PM, Andrew Coppin <span dir="ltr">&lt;<a href="mailto:andrewcoppin@btinternet.com">andrewcoppin@btinternet.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">Robert Greayer wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
f0 _ = (foo True, foo &#39;x&#39;) where foo = id<br>
<br>
is well-typed.<br>
  <br>
</blockquote>
<br></div>
Really? That actually works? How interesting... This suggests to me that where-clauses also do strange things to the type system.</blockquote><div><br>You could think of it that way.  You mentioned GADTs in your OP.  Well, it turns out GADTs often do not play nicely with where/let and it happens to all be related.  As I understand it, functions bind their parameters monomorphically and let/where bind things polymorphically.  And then we have the misfeature known as the monomorphism restriction which adds special cases.<br>
<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im"><br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
whereas<br>
<br>
f1 foo = (foo True, foo &#39;x&#39;)<br>
<br>
requires &#39;foo&#39; to be polymorphic in its first argument.  This does<br>
require a higher rank type, which can&#39;t be inferred:<br>
<br>
You could type f1 as<br>
f1 :: (forall a . a -&gt; a)  -&gt; (Bool, Char)<br>
<br>
and apply it to &#39;id&#39;.<br>
<br>
Or you could type it as something like:<br>
f1 :: (forall a . a -&gt; ()) -&gt; ((),())<br>
<br>
and apply it to &#39;const ()&#39;<br>
</blockquote>
<br></div>
...all of which is beyond Haskell-98, which is what I am limiting myself to at present.<br>
<br>
(Actually, even that is a lie. I don&#39;t have type-classes yet...)</blockquote><div><br>Congrats on the type inference engine you&#39;re writing.  It&#39;s on my list of things to do, and I was even reading up on TaPL a month or two back, but I put it down and haven&#39;t picked it up again yet.  I think writing one would help flush out my understand of all this stuff.<br>
<br>Jason<br></div></div><br>