<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: My first trip to the phantom zone</title>
	<atom:link href="http://therning.org/magnus/archives/323/feed" rel="self" type="application/rss+xml" />
	<link>http://therning.org/magnus/archives/323?&amp;owa_from=feed&amp;owa_sid=</link>
	<description>Incoherent mumblings</description>
	<pubDate>Fri, 29 Aug 2008 21:57:56 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.1</generator>
		<item>
		<title>By: Magnus</title>
		<link>http://therning.org/magnus/archives/323#comment-82443</link>
		<dc:creator>Magnus</dc:creator>
		<pubDate>Wed, 17 Oct 2007 22:37:47 +0000</pubDate>
		<guid isPermaLink="false">http://therning.org/magnus/archives/323#comment-82443</guid>
		<description>&lt;p&gt;Derek, you are absolutely right.  I don't want to get into an argument here, but &lt;em&gt;you still have to explicitly set the type of &lt;tt&gt;add&lt;/tt&gt;&lt;/em&gt;.  If you don't it ends up with the type &lt;code&gt;MyPh a -&#62; MyPh b -&#62; MyPh c&lt;/code&gt; anyway.  So, in the strictest sense, I don't see your code allowing any type inference to take place either.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Derek, you are absolutely right.  I don&#8217;t want to get into an argument here, but <em>you still have to explicitly set the type of <tt>add</tt></em>.  If you don&#8217;t it ends up with the type <code>MyPh a -&gt; MyPh b -&gt; MyPh c</code> anyway.  So, in the strictest sense, I don&#8217;t see your code allowing any type inference to take place either.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Derek Elkins</title>
		<link>http://therning.org/magnus/archives/323#comment-82417</link>
		<dc:creator>Derek Elkins</dc:creator>
		<pubDate>Wed, 17 Oct 2007 18:13:41 +0000</pubDate>
		<guid isPermaLink="false">http://therning.org/magnus/archives/323#comment-82417</guid>
		<description>&lt;p&gt;add' (Left x)  (Left y)  = Left (x+y)
add' (Right x) (Right y) = Right (x++y)&lt;/p&gt;

&lt;p&gt;add :: MyPh a -&#62; MyPh a -&#62; MyPh a
add (MyPh x) (MyPh y) = MyPh (add' x y)&lt;/p&gt;

&lt;p&gt;The uncovered cases in add' can never come up if all you provide is add and phString, phInt.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>add&#8217; (Left x)  (Left y)  = Left (x+y)<br />
add&#8217; (Right x) (Right y) = Right (x++y)</p>
<p>add :: MyPh a -&gt; MyPh a -&gt; MyPh a<br />
add (MyPh x) (MyPh y) = MyPh (add&#8217; x y)</p>
<p>The uncovered cases in add&#8217; can never come up if all you provide is add and phString, phInt.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Magnus</title>
		<link>http://therning.org/magnus/archives/323#comment-82385</link>
		<dc:creator>Magnus</dc:creator>
		<pubDate>Wed, 17 Oct 2007 09:45:21 +0000</pubDate>
		<guid isPermaLink="false">http://therning.org/magnus/archives/323#comment-82385</guid>
		<description>&lt;p&gt;I did mention that the inferred type isn't of much use.  Even though I got the inferred type slightly wrong (it's been corrected by now though).&lt;/p&gt;

&lt;p&gt;AFAIU the Haskell type system could &lt;em&gt;never&lt;/em&gt; infer the types &lt;code&gt;MyPh Int&lt;/code&gt; and &lt;code&gt;MyPh String&lt;/code&gt;, and whether they are inferred or not isn't really the point with &lt;em&gt;phantom types&lt;/em&gt;.  The point is that the implementation doesn't need to handle some error cases that could arise otherwise, and the user of the API gets help from the compiler to make sure the types match up.&lt;/p&gt;

&lt;p&gt;I don't understand what you mean by "you could combine them together into one function with that type".  Please explain further.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I did mention that the inferred type isn&#8217;t of much use.  Even though I got the inferred type slightly wrong (it&#8217;s been corrected by now though).</p>
<p>AFAIU the Haskell type system could <em>never</em> infer the types <code>MyPh Int</code> and <code>MyPh String</code>, and whether they are inferred or not isn&#8217;t really the point with <em>phantom types</em>.  The point is that the implementation doesn&#8217;t need to handle some error cases that could arise otherwise, and the user of the API gets help from the compiler to make sure the types match up.</p>
<p>I don&#8217;t understand what you mean by &#8220;you could combine them together into one function with that type&#8221;.  Please explain further.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Derek Elkins</title>
		<link>http://therning.org/magnus/archives/323#comment-82374</link>
		<dc:creator>Derek Elkins</dc:creator>
		<pubDate>Tue, 16 Oct 2007 16:31:26 +0000</pubDate>
		<guid isPermaLink="false">http://therning.org/magnus/archives/323#comment-82374</guid>
		<description>&lt;p&gt;You would gain something if that was the type signature that Haskell inferred for add/cat*, but that isn't the type Haskell would infer.  It would infer MyPh a -&#62; MyPh b -&#62; MyPh c and -that- would give you nothing.&lt;/p&gt;

&lt;p&gt;* In fact, you could combine them together into one function with that type (the one you listed) and it would be just as safe as having each of them (at least in the way you discussed in the post.)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>You would gain something if that was the type signature that Haskell inferred for add/cat*, but that isn&#8217;t the type Haskell would infer.  It would infer MyPh a -&gt; MyPh b -&gt; MyPh c and -that- would give you nothing.</p>
<p>* In fact, you could combine them together into one function with that type (the one you listed) and it would be just as safe as having each of them (at least in the way you discussed in the post.)</p>
]]></content:encoded>
	</item>
</channel>
</rss>
