<?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: Adventures in parsing, part 4</title>
	<atom:link href="http://therning.org/magnus/archives/296/feed" rel="self" type="application/rss+xml" />
	<link>http://therning.org/magnus/archives/296</link>
	<description>Incoherent mumblings</description>
	<lastBuildDate>Wed, 08 Aug 2012 00:21:01 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
	<item>
		<title>By: Magnus</title>
		<link>http://therning.org/magnus/archives/296/comment-page-1#comment-59349</link>
		<dc:creator>Magnus</dc:creator>
		<pubDate>Wed, 06 Jun 2007 23:28:31 +0000</pubDate>
		<guid isPermaLink="false">http://therning.org/magnus/archives/296#comment-59349</guid>
		<description><![CDATA[&lt;p&gt;Conal, that&#039;s exactly what I mean, just much more clearly expressed than I could ever hope to do.&lt;/p&gt;

&lt;p&gt;I too was thinking of the problem with &lt;code&gt;space&lt;/code&gt; in an operator...&lt;/p&gt;
]]></description>
		<content:encoded><![CDATA[<p>Conal, that&#8217;s exactly what I mean, just much more clearly expressed than I could ever hope to do.</p>

<p>I too was thinking of the problem with <code>space</code> in an operator&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Conal Elliott</title>
		<link>http://therning.org/magnus/archives/296/comment-page-1#comment-59066</link>
		<dc:creator>Conal Elliott</dc:creator>
		<pubDate>Wed, 06 Jun 2007 16:56:03 +0000</pubDate>
		<guid isPermaLink="false">http://therning.org/magnus/archives/296#comment-59066</guid>
		<description><![CDATA[&lt;p&gt;Oh!  I&#039;m finally getting what you&#039;ve meant about &quot;hiding things&quot; vs &quot;reflect[ing] the structure of the &lt;code&gt;maps&lt;/code&gt; file&quot;.  I think you want the separator characters to show up in the parser, and between the sub-parsers that they separate.&lt;/p&gt;

&lt;p&gt;Maybe what&#039;s missing in my &lt;code&gt;&lt;#&gt;&lt;/code&gt; suggestion is that the choice of the space character as a separator is far from obvious, and I guess that&#039;s what you&#039;re saying about &quot;mental baggage&quot; naming the operators for easy reading.&lt;/p&gt;

&lt;p&gt;I suppose you could use &lt;code&gt;sepSpace&lt;/code&gt; and &lt;code&gt;sepColon&lt;/code&gt; as operator names.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;parseAddress = Address &lt;$&gt; hexStr `sepColon` hexStr

parseRegion = MemRegion &lt;$&gt;
    parseAddress `sepSpace`
    parsePerms `sepSpace`
    ...
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Still, an actual space/colon character would probably be clearer.  For colon, you could use &lt;code&gt;&lt;:&gt;&lt;/code&gt;, but what for space?&lt;/p&gt;
]]></description>
		<content:encoded><![CDATA[<p>Oh!  I&#8217;m finally getting what you&#8217;ve meant about &#8220;hiding things&#8221; vs &#8220;reflect[ing] the structure of the <code>maps</code> file&#8221;.  I think you want the separator characters to show up in the parser, and between the sub-parsers that they separate.</p>

<p>Maybe what&#8217;s missing in my <code>&lt;#&gt;</code> suggestion is that the choice of the space character as a separator is far from obvious, and I guess that&#8217;s what you&#8217;re saying about &#8220;mental baggage&#8221; naming the operators for easy reading.</p>

<p>I suppose you could use <code>sepSpace</code> and <code>sepColon</code> as operator names.</p>

<pre><code>parseAddress = Address &lt;$&gt; hexStr `sepColon` hexStr

parseRegion = MemRegion &lt;$&gt;
    parseAddress `sepSpace`
    parsePerms `sepSpace`
    ...
</code></pre>

<p>Still, an actual space/colon character would probably be clearer.  For colon, you could use <code>&lt;:&gt;</code>, but what for space?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Magnus</title>
		<link>http://therning.org/magnus/archives/296/comment-page-1#comment-58838</link>
		<dc:creator>Magnus</dc:creator>
		<pubDate>Wed, 06 Jun 2007 08:51:31 +0000</pubDate>
		<guid isPermaLink="false">http://therning.org/magnus/archives/296#comment-58838</guid>
		<description><![CDATA[&lt;p&gt;Conal, you are right and I was unclear in what I meant. Basically I like the idea of reading the &lt;code&gt;parseXxx&lt;/code&gt; functions and see the structure of the original &lt;code&gt;maps&lt;/code&gt; file. At the moment I think that&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;parseAddress = Address &lt;$&gt;
    hexStr &lt;##&gt; &#039;-&#039; &lt;*&gt;
    hexStr
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;better reflects the structure of the &lt;code&gt;maps&lt;/code&gt; file than hiding away the separator inside an operator. I also find it doesn&#039;t require me to carry a lot of &quot;mental baggage&quot; when reading the code (I suspect this is the thing that&#039;s been bothering me with the love of introducing operators that seems so prevalent among Haskell developers, thanks for helping me put a finger on it). However, your persistence might be paying off ;-)  I&#039;m warming to the idea. I just have to come up with a scheme for naming operators that allows easy reading of the code.&lt;/p&gt;
]]></description>
		<content:encoded><![CDATA[<p>Conal, you are right and I was unclear in what I meant. Basically I like the idea of reading the <code>parseXxx</code> functions and see the structure of the original <code>maps</code> file. At the moment I think that</p>

<pre><code>parseAddress = Address &lt;$&gt;
    hexStr &lt;##&gt; '-' &lt;*&gt;
    hexStr
</code></pre>

<p>better reflects the structure of the <code>maps</code> file than hiding away the separator inside an operator. I also find it doesn&#8217;t require me to carry a lot of &#8220;mental baggage&#8221; when reading the code (I suspect this is the thing that&#8217;s been bothering me with the love of introducing operators that seems so prevalent among Haskell developers, thanks for helping me put a finger on it). However, your persistence might be paying off <img src='http://therning.org/magnus/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />   I&#8217;m warming to the idea. I just have to come up with a scheme for naming operators that allows easy reading of the code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Conal Elliott</title>
		<link>http://therning.org/magnus/archives/296/comment-page-1#comment-58540</link>
		<dc:creator>Conal Elliott</dc:creator>
		<pubDate>Wed, 06 Jun 2007 00:17:54 +0000</pubDate>
		<guid isPermaLink="false">http://therning.org/magnus/archives/296#comment-58540</guid>
		<description><![CDATA[&lt;p&gt;Magnus wrote&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;I also don’t want to hide things, e.g. I don’t want to introduce a function that turns (a &lt;* char &#039; &#039;) &lt;*&gt; b into a &lt;#&gt; b.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I&#039;m puzzled about this comment.  Aren&#039;t all of your definitions (as well as much of Parsec and other Haskell libraries) &quot;hiding things&quot;?&lt;/p&gt;

&lt;p&gt;What appeals to me about &lt;code&gt;a &lt;#&gt; b = (a &lt;* char &#039; &#039;) &lt;*&gt; b&lt;/code&gt; (and similarly for, say &quot;&lt;code&gt;a &lt;:&gt; b&lt;/code&gt;&quot;, is that it captures the combination of a character separator and &lt;*&gt;-style application.  As your example illustrates (and hadn&#039;t previously occurred to me), this combination is very common.&lt;/p&gt;

&lt;p&gt;BTW, thanks much for adding the &quot;preview&quot; button.&lt;/p&gt;
]]></description>
		<content:encoded><![CDATA[<p>Magnus wrote</p>

<blockquote>
  <p>I also don’t want to hide things, e.g. I don’t want to introduce a function that turns (a &lt;* char &#8216; &#8216;) &lt;*&gt; b into a &lt;#&gt; b.</p>
</blockquote>

<p>I&#8217;m puzzled about this comment.  Aren&#8217;t all of your definitions (as well as much of Parsec and other Haskell libraries) &#8220;hiding things&#8221;?</p>

<p>What appeals to me about <code>a &lt;#&gt; b = (a &lt;* char ' ') &lt;*&gt; b</code> (and similarly for, say &#8220;<code>a &lt;:&gt; b</code>&#8220;, is that it captures the combination of a character separator and &lt;*&gt;-style application.  As your example illustrates (and hadn&#8217;t previously occurred to me), this combination is very common.</p>

<p>BTW, thanks much for adding the &#8220;preview&#8221; button.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jedaï</title>
		<link>http://therning.org/magnus/archives/296/comment-page-1#comment-58364</link>
		<dc:creator>Jedaï</dc:creator>
		<pubDate>Tue, 05 Jun 2007 19:53:27 +0000</pubDate>
		<guid isPermaLink="false">http://therning.org/magnus/archives/296#comment-58364</guid>
		<description><![CDATA[&lt;p&gt;That&#039;s really pretty ! Code you can read, but concise, Haskell is really good at that, though I need to look at how Applicative works its magic. :)&lt;/p&gt;

&lt;p&gt;Good work !&lt;/p&gt;
]]></description>
		<content:encoded><![CDATA[<p>That&#8217;s really pretty ! Code you can read, but concise, Haskell is really good at that, though I need to look at how Applicative works its magic. <img src='http://therning.org/magnus/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>

<p>Good work !</p>
]]></content:encoded>
	</item>
</channel>
</rss>
