<div dir="ltr"><br><br><div class="gmail_quote">On Sun, Jul 25, 2010 at 1:00 PM, Mark Bradley <span dir="ltr">&lt;<a href="mailto:barkmadley@gmail.com">barkmadley@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Sun, Jul 25, 2010 at 3:40 AM, Michael Snoyman &lt;<a href="mailto:michael@snoyman.com">michael@snoyman.com</a>&gt; wrote:<br>
&gt; Implementing that feature was amazingly simple. I&#39;m still not 100% sold on<br>
&gt; the syntax, as I&#39;m worried it&#39;s complicated Hamlet too much. But having the<br>
&gt; feature available probably isn&#39;t too dangerous. It also doesn&#39;t cause any<br>
&gt; problems with existing code as far as my tests go.<br>
&gt; As a bonus, the $forall/$maybe issue was very easy to solve: just surround<br>
&gt; it with parentheses.<br>
&gt; [$hamlet|<br>
&gt; $forall ((foo bar) baz) bin<br>
&gt;    $bin$<br>
&gt; |]<br>
<br>
</div>well done on being so quick.  I didn&#39;t even get a chance to try and<br>
implement it myself.<br>
<br>
The code looks very clean and accurate.  Should the spaces allowed<br>
argument be propagated to the sub expression parser derefParens?<br>
<br></blockquote><div>It&#39;s not necessary; the only reason to disallow spaces is when dealing with a $forall et al. However, once inside parentheses, we can allow the spaces without ambiguity.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

Also doesn&#39;t parsec have a between combinator?<br>
<br>
i.e.<br>
    derefParens as = between (char &#39;(&#39;) (char &#39;)&#39;) (deref as)<br>
    derefSingle as = derefParens as &lt;|&gt; fmap DerefLeaf ident<br>
    deref spaceAllowed = do<br>
        let delim = if spaceAllowed<br>
                        then (char &#39;.&#39; &lt;|&gt; (many1 (char &#39; &#39;) &gt;&gt; return &#39; &#39;))<br>
                        else char &#39;.&#39;<br>
        x &lt;- derefSingle spaceAllowed<br>
        xs &lt;- many $ delim &gt;&gt; derefSingle<br>
        return $ foldr1 DerefBranch $ x : xs<br><font class="Apple-style-span" color="#888888"><br></font></blockquote><div>I wasn&#39;t aware of between, cleaned up the code nicely. Thanks! Unless there&#39;s objections, I&#39;ll release the new code as Hamlet 0.4.1.</div>
<div><br></div><div>Michael</div></div></div>