<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Data Constructors and Readability</title>
	<atom:link href="http://www.elharo.com/blog/software-development/haskell/2009/02/05/data-constructors-and-readability/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.elharo.com/blog/software-development/haskell/2009/02/05/data-constructors-and-readability/</link>
	<description>Ranting and Raving</description>
	<lastBuildDate>Thu, 09 Feb 2012 17:01:34 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
	<item>
		<title>By: Elliotte</title>
		<link>http://www.elharo.com/blog/software-development/haskell/2009/02/05/data-constructors-and-readability/comment-page-1/#comment-664427</link>
		<dc:creator>Elliotte</dc:creator>
		<pubDate>Sat, 07 Feb 2009 01:54:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.elharo.com/blog/?p=1002094#comment-664427</guid>
		<description>I should probably set the stylesheet not to make pre text bold though...</description>
		<content:encoded><![CDATA[<p>I should probably set the stylesheet not to make pre text bold though&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Elliotte</title>
		<link>http://www.elharo.com/blog/software-development/haskell/2009/02/05/data-constructors-and-readability/comment-page-1/#comment-664424</link>
		<dc:creator>Elliotte</dc:creator>
		<pubDate>Sat, 07 Feb 2009 01:53:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.elharo.com/blog/?p=1002094#comment-664424</guid>
		<description>Aha! It worked. Everyone should be able to use pre here now. I&#039;ll to make the same change on the Cafes. 

Thanks for the nudge.</description>
		<content:encoded><![CDATA[<p>Aha! It worked. Everyone should be able to use pre here now. I&#8217;ll to make the same change on the Cafes. </p>
<p>Thanks for the nudge.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Elliotte</title>
		<link>http://www.elharo.com/blog/software-development/haskell/2009/02/05/data-constructors-and-readability/comment-page-1/#comment-664422</link>
		<dc:creator>Elliotte</dc:creator>
		<pubDate>Sat, 07 Feb 2009 01:53:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.elharo.com/blog/?p=1002094#comment-664422</guid>
		<description>Let&#039;s see if this works now:

&lt;pre&gt;so much depends on
   a red Haskell
     furiously thinking
        green thoughts&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Let&#8217;s see if this works now:</p>
<pre>so much depends on
   a red Haskell
     furiously thinking
        green thoughts</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: elharo</title>
		<link>http://www.elharo.com/blog/software-development/haskell/2009/02/05/data-constructors-and-readability/comment-page-1/#comment-664416</link>
		<dc:creator>elharo</dc:creator>
		<pubDate>Sat, 07 Feb 2009 01:51:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.elharo.com/blog/?p=1002094#comment-664416</guid>
		<description>OK. The problem isn&#039;t registration. It&#039;s that pre is specifically disallowed (more accurately, not specifically allowed). let me see if I can fix that.</description>
		<content:encoded><![CDATA[<p>OK. The problem isn&#8217;t registration. It&#8217;s that pre is specifically disallowed (more accurately, not specifically allowed). let me see if I can fix that.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: elharo</title>
		<link>http://www.elharo.com/blog/software-development/haskell/2009/02/05/data-constructors-and-readability/comment-page-1/#comment-664411</link>
		<dc:creator>elharo</dc:creator>
		<pubDate>Sat, 07 Feb 2009 01:45:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.elharo.com/blog/?p=1002094#comment-664411</guid>
		<description>Nope, that didn&#039;t work.</description>
		<content:encoded><![CDATA[<p>Nope, that didn&#8217;t work.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: elharo</title>
		<link>http://www.elharo.com/blog/software-development/haskell/2009/02/05/data-constructors-and-readability/comment-page-1/#comment-664410</link>
		<dc:creator>elharo</dc:creator>
		<pubDate>Sat, 07 Feb 2009 01:44:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.elharo.com/blog/?p=1002094#comment-664410</guid>
		<description>OK, Let&#039;s see if this works:


  This is some
  preformatted
  text
     so much depends on
         a red Haskell
           furiously thinking 
              green thoughts
</description>
		<content:encoded><![CDATA[<p>OK, Let&#8217;s see if this works:</p>
<p>  This is some<br />
  preformatted<br />
  text<br />
     so much depends on<br />
         a red Haskell<br />
           furiously thinking<br />
              green thoughts</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Elliotte Rusty Harold</title>
		<link>http://www.elharo.com/blog/software-development/haskell/2009/02/05/data-constructors-and-readability/comment-page-1/#comment-664405</link>
		<dc:creator>Elliotte Rusty Harold</dc:creator>
		<pubDate>Sat, 07 Feb 2009 01:39:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.elharo.com/blog/?p=1002094#comment-664405</guid>
		<description>I fixed your comment. I think you have to register to be allowed to use HTML, but I turned off registration a few months ago because no one did, and a security hole had been found in it. Let me turn it back on and see what happens.</description>
		<content:encoded><![CDATA[<p>I fixed your comment. I think you have to register to be allowed to use HTML, but I turned off registration a few months ago because no one did, and a security hole had been found in it. Let me turn it back on and see what happens.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Day</title>
		<link>http://www.elharo.com/blog/software-development/haskell/2009/02/05/data-constructors-and-readability/comment-page-1/#comment-664388</link>
		<dc:creator>Michael Day</dc:creator>
		<pubDate>Sat, 07 Feb 2009 01:14:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.elharo.com/blog/?p=1002094#comment-664388</guid>
		<description>...and my nicely formatted &lt;pre&gt; has been mangled, sigh.</description>
		<content:encoded><![CDATA[<p>&#8230;and my nicely formatted &lt;pre&gt; has been mangled, sigh.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Day</title>
		<link>http://www.elharo.com/blog/software-development/haskell/2009/02/05/data-constructors-and-readability/comment-page-1/#comment-664387</link>
		<dc:creator>Michael Day</dc:creator>
		<pubDate>Sat, 07 Feb 2009 01:13:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.elharo.com/blog/?p=1002094#comment-664387</guid>
		<description>Try Mercury: like Haskell, but more parentheses :)

&lt;pre&gt;:- type doc
    ---&gt;    char(char)
    ;       text(string)
    ;       line
    ;       concat(doc, doc)
    ;       union(doc, doc).&lt;/pre&gt;
</description>
		<content:encoded><![CDATA[<p>Try Mercury: like Haskell, but more parentheses :)</p>
<pre>:- type doc
    ---&gt;    char(char)
    ;       text(string)
    ;       line
    ;       concat(doc, doc)
    ;       union(doc, doc).</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Elliotte Rusty Harold</title>
		<link>http://www.elharo.com/blog/software-development/haskell/2009/02/05/data-constructors-and-readability/comment-page-1/#comment-663923</link>
		<dc:creator>Elliotte Rusty Harold</dc:creator>
		<pubDate>Fri, 06 Feb 2009 15:01:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.elharo.com/blog/?p=1002094#comment-663923</guid>
		<description>Java doesn&#039;t have algebraic data types and pattern matching as such, so there these would probably be subclasses. E.g.

&lt;pre&gt;public abstract class Doc {
}

public class Empty extends Doc {
}

public class Text extends Doc {

  public Text(String s) {
  }

}
&lt;/pre&gt;

and so forth. This isn&#039;t ideal because this isn&#039;t how you&#039;d solve this problem in Java.

However if one were to imagine a true Haskell equivalent that used Java-like syntax but Haskell semantics you might see something like this:

&lt;pre&gt;datatype Doc implements Show, Eq {
  
  constructor Char (Char c);
  constructor Text (String s);
  constructor Line();
  constructor Empty();
  constructor Concat(Doc d1, Doc d2);
  constructor Union(Doc d1, Doc d2);

}
&lt;/pre&gt;

That could mean exactly the same thing as the actual Haskell; but I for one would find it much easier to read. Yes, it takes a little longer to type, but ease of reading trumps ease of typing. 

Of course we could play with the exact keywords. Maybe &lt;code&gt;adt&lt;/code&gt; or &lt;code&gt;data&lt;/code&gt; instead of &lt;code&gt;datatype&lt;/code&gt;; maybe &lt;code&gt;new&lt;/code&gt; instead of &lt;code&gt;constructor&lt;/code&gt;, but you get the idea.</description>
		<content:encoded><![CDATA[<p>Java doesn&#8217;t have algebraic data types and pattern matching as such, so there these would probably be subclasses. E.g.</p>
<pre>public abstract class Doc {
}

public class Empty extends Doc {
}

public class Text extends Doc {

  public Text(String s) {
  }

}
</pre>
<p>and so forth. This isn&#8217;t ideal because this isn&#8217;t how you&#8217;d solve this problem in Java.</p>
<p>However if one were to imagine a true Haskell equivalent that used Java-like syntax but Haskell semantics you might see something like this:</p>
<pre>datatype Doc implements Show, Eq {

  constructor Char (Char c);
  constructor Text (String s);
  constructor Line();
  constructor Empty();
  constructor Concat(Doc d1, Doc d2);
  constructor Union(Doc d1, Doc d2);

}
</pre>
<p>That could mean exactly the same thing as the actual Haskell; but I for one would find it much easier to read. Yes, it takes a little longer to type, but ease of reading trumps ease of typing. </p>
<p>Of course we could play with the exact keywords. Maybe <code>adt</code> or <code>data</code> instead of <code>datatype</code>; maybe <code>new</code> instead of <code>constructor</code>, but you get the idea.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

