<?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: 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>
	<pubDate>Tue, 18 Nov 2008 21:40:38 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.3</generator>
		<item>
		<title>By: Magnus</title>
		<link>http://therning.org/magnus/archives/296#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>&lt;p&gt;Conal, that'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-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>&lt;p&gt;Oh!  I'm finally getting what you've meant about "hiding things" vs "reflect[ing] the structure of the &lt;code&gt;maps&lt;/code&gt; file".  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's missing in my &lt;code&gt;&#60;#&#62;&lt;/code&gt; suggestion is that the choice of the space character as a separator is far from obvious, and I guess that's what you're saying about "mental baggage" 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 &#60;$&#62; hexStr `sepColon` hexStr

parseRegion = MemRegion &#60;$&#62;
    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;&#60;:&#62;&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-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>&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 &#60;$&#62;
    hexStr &#60;##&#62; '-' &#60;*&#62;
    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't require me to carry a lot of "mental baggage" when reading the code (I suspect this is the thing that'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'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-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>&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 &#60;* char ' ') &#60;*&#62; b into a &#60;#&#62; b.&lt;/p&gt;
&lt;/blockquote&gt;

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

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

&lt;p&gt;BTW, thanks much for adding the "preview" 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-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>&lt;p&gt;That'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>
