<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Alson Kemp &#187; Geekery</title>
	<atom:link href="http://www.alsonkemp.com/category/geekery/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.alsonkemp.com</link>
	<description>Hackfoofery</description>
	<lastBuildDate>Fri, 16 Jul 2010 18:18:32 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>KickLabs (SF Incubator)</title>
		<link>http://www.alsonkemp.com/geekery/kicklabs-sf-incubator/</link>
		<comments>http://www.alsonkemp.com/geekery/kicklabs-sf-incubator/#comments</comments>
		<pubDate>Fri, 16 Jul 2010 18:18:32 +0000</pubDate>
		<dc:creator>alson</dc:creator>
				<category><![CDATA[Geekery]]></category>

		<guid isPermaLink="false">http://www.alsonkemp.com/?p=397</guid>
		<description><![CDATA[Great incubator just opened in downtown San Francisco: KickLabs.  Ridiculously great space, a great team and a list of exciting events.  Definitely a place to get to know.

And they welcome entrepreneurs of all ages!


]]></description>
			<content:encoded><![CDATA[<p>Great incubator just opened in downtown San Francisco: <a href="http://www.kicklabs.com" target="_blank">KickLabs</a>.  Ridiculously great space, a great team and a list of exciting events.  Definitely a place to get to know.</p>

<p>And they welcome entrepreneurs of all ages!</p>

<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="640" height="385" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/4GaiuTQJF6s&amp;hl=en_US&amp;fs=1" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="640" height="385" src="http://www.youtube.com/v/4GaiuTQJF6s&amp;hl=en_US&amp;fs=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.alsonkemp.com/geekery/kicklabs-sf-incubator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HighCharts, Bluff, gRaphael &#8211; Javascript charting libraries</title>
		<link>http://www.alsonkemp.com/tools/highcharts-javascript-charting-library/</link>
		<comments>http://www.alsonkemp.com/tools/highcharts-javascript-charting-library/#comments</comments>
		<pubDate>Thu, 03 Dec 2009 00:49:43 +0000</pubDate>
		<dc:creator>alson</dc:creator>
				<category><![CDATA[Geekery]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://www.alsonkemp.com/?p=342</guid>
		<description><![CDATA[Bumped into HighCharts today.  See here: http://highcharts.com Very nice library for embedding charts into your HTML.  Nice to see that browsers are finally getting to the point that HighCharts can be written.   Also, it&#8217;s nice to think about being able to dump Flash charting solutions in favor of a simple Javascript library.  Worth the $80 [...]]]></description>
			<content:encoded><![CDATA[<p>Bumped into HighCharts today.  See here: <a href="http://highcharts.com" target="_blank">http://highcharts.com</a> Very nice library for embedding charts into your HTML.  Nice to see that browsers are finally getting to the point that HighCharts can be written.   Also, it&#8217;s nice to think about being able to dump Flash charting solutions in favor of a simple Javascript library.  Worth the $80 for commercial use (I don&#8217;t know about you, but I&#8217;ve spent well more than $80 of my time wrestling with an open source Flash charting library).</p>

<hr />

<p>[Updating post to add more libs.]</p>

<p>Okay.  I got called out for not poking around a bit more.  There are nice open-source, liberally licensed JS chart libs.</p>

<h3>Open Source</h3>

<p><a href="http://bluff.jcoglan.com" target="_blank">Bluff</a> : Ruby&#8217;s <a href="http://nubyonrails.com/pages/gruff" target="_blank">Gruff</a> ported to JS.  Looks pretty straightforward.</p>

<p><a href="http://g.raphaeljs.com/" target="_blank">gRaphael</a> : built on the awesome Raphael JS vector graphics library.  Limited functionality, but that&#8217;ll change.</p>

<p><a href="http://dragan.yourtree.org/code/canvas-3d-graph/" target="_blank">Canvas3D</a> : super cool, but not sure if it&#8217;s ready for a production site&#8230;</p>

<p><a href="http://www.jqplot.com" target="_blank">jqPlot</a> : charting for jQuery.  I&#8217;m neither pro- nor con-jQuery, so I&#8217;m not sure that I&#8217;d pick a jQuery-centric library.</p>

<p><a href="http://www.liquidx.net/plotkit/" target="_blank">PlotKit</a> : dependent on MochiKit.</p>

<p><a href="http://code.google.com/p/flot/" target="_blank">Flot</a> : charting for jQuery.  Again, since I use different JS libraries in different circumstances/apps, I&#8217;m not excited about having to pull in jQuery, but Flot looks nice.</p>

<h3>Commercial License</h3>

<p><a href="http://www.jscharts.com/" target="_blank">JSCharts</a> : HighCharts looks prettier&#8230;  $129 for a license for all of your sites (vs. $360 for <a href="http://highcharts.com" target="_blank">HighCharts</a>)</p>

<p><a href="http://www.ejschart.com" target="_blank">Emprise Charts</a> : Very nice.  Pricing is inline with JSCharts and HighCharts.</p>

<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 113px; width: 1px; height: 1px;">http://www.liquidx.net/plotkit/</div>
]]></content:encoded>
			<wfw:commentRss>http://www.alsonkemp.com/tools/highcharts-javascript-charting-library/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>PS3 + Linux Media Serving (MythTV?  GMediaServer?  MediaTomb?)</title>
		<link>http://www.alsonkemp.com/geekery/ps3-linux-media-serving-mythtv-gmediaserver-mediatomb/</link>
		<comments>http://www.alsonkemp.com/geekery/ps3-linux-media-serving-mythtv-gmediaserver-mediatomb/#comments</comments>
		<pubDate>Mon, 09 Mar 2009 19:19:38 +0000</pubDate>
		<dc:creator>alson</dc:creator>
				<category><![CDATA[Geekery]]></category>
		<category><![CDATA[ps3 mediatomb]]></category>

		<guid isPermaLink="false">http://www.alsonkemp.com/?p=305</guid>
		<description><![CDATA[I recently got a PS3 (which is a lovely piece of hardware and software) and, given our collections of MP3s, WMAs and AVIs (a bunch of ripped children&#8217;s DVDs so that my son is free to physically shred up the actual DVDs), have been trying to figure out how to serve media to it over [...]]]></description>
			<content:encoded><![CDATA[<p>I recently got a PS3 (which is a lovely piece of hardware and software) and, given our collections of MP3s, WMAs and AVIs (a bunch of ripped children&#8217;s DVDs so that my son is free to physically shred up the actual DVDs), have been trying to figure out how to serve media to it over the network.</p>

<p>Serving from Windows is ludicrously simple using <a href="http://www.microsoft.com/windows/windowsmedia/player/11/default.aspx" target="_blank">Windows Media Player 11</a> or <a href="http://www.tversity.com" target="_blank">TVersity</a>, but I have a small, super-old-school Linux file server used for backups-and-such and I wanted to use it to serve media.  Turns out to be very simple to do so.</p>

<p>MythTV is the big guy in this space, but it had a number of issues for me:</p>

<ul>
    <li>Not particularly straightforward to set up (considering the very simple use case I had for it).</li>
    <li>Tons of functionality that I didn&#8217;t need, including a heavy front-end app (though there is a lighter weight web app I could have installed).</li>
    <li>I couldn&#8217;t figure out how to get it to serve WMAs and, since I&#8217;ve ripped a bunch of CDs to WMA, this was a killer.</li>
</ul>

<p>None of this is to say that MythTV is not a great piece of software; it was just way more than I needed.</p>

<p><a href="http://www.gnu.org/software/gmediaserver/" target="_blank">GMediaServer</a> is a GNU uPNP media server and it looked pretty good, but I wasn&#8217;t sure that it would serve video.  Documentation is a also bit lacking.</p>

<p>Enter <a href="http://mediatomb.cc/" target="_blank">MediaTomb</a>.  Simple, lightweight, basic media serving.  &#8220;apt-get install mediatomb&#8221; and I was pretty much there.  A slight, very well documented modification to the configuration file and I popped open a web browser, browsed to the built-in web interface and told MediaTomb to server my /share/media directory.  Walked over to my PS3 (on which the MediaTomb server was already listed) and started browsing my media files.</p>

<p>The only issue I had was when I updated the media files on the server.  Sometimes MediaTomb wouldn&#8217;t see the modifications and would send to the PS3 out-of-date data, probably because I was using inotify rather than just time-based refresh.  I switched to the time-based refresh and deleted the MediaTomb SQLite database and all was right with the world.</p>

<p>Useful links:</p>

<ul>
    <li>http://www.mediatomb.cc</li>
    <li>http://ubuntuforums.org/showthread.php?t=650020</li>
    <li>http://www.freesoftwaremagazine.com/columns/upnp_mediatomb_ps3_and_me</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.alsonkemp.com/geekery/ps3-linux-media-serving-mythtv-gmediaserver-mediatomb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Turbinado update</title>
		<link>http://www.alsonkemp.com/haskell/turbinado-update/</link>
		<comments>http://www.alsonkemp.com/haskell/turbinado-update/#comments</comments>
		<pubDate>Thu, 18 Dec 2008 18:13:43 +0000</pubDate>
		<dc:creator>alson</dc:creator>
				<category><![CDATA[Geekery]]></category>
		<category><![CDATA[Haskell]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Turbinado]]></category>

		<guid isPermaLink="false">http://www.alsonkemp.com/?p=147</guid>
		<description><![CDATA[ For those of you interested in Turbinado, here&#8217;s a quick status update:


    I separated the code for the turbinado.org website from the code for the framework.  The framework is here and the website code is here.
    I&#8217;m going to finish up implementing HAML templating for Turbinado in the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="www.turbinado.org"><img class="alignright" style="margin-left: 10px; margin-right: 10px;" src="http://turbinado.org/images/turbinado.jpg" alt="Turbinado Logo" width="130" height="165" /></a> For those of you interested in <a href="http://turbinado.org" target="_blank">Turbinado</a>, here&#8217;s a quick status update:</p>

<ul>
    <li>I separated the code for the <a href="http://turbinado.org" target="_blank">turbinado.org</a> website from the code for the framework.  The framework is <a href="http://github.com/alsonkemp/turbinado" target="_blank">here</a> and the website code is <a href="http://github.com/alsonkemp/turbinado-website" target="_blank">here</a>.</li>
    <li>I&#8217;m going to finish up implementing HAML templating for Turbinado in the next few days.</li>
    <li>After HAML templates are in, I&#8217;ll provide a tutorial on implementing a mini-CMS/wiki in Turbinado (the code is already in the <a href="http://github.com/alsonkemp/turbinado-website" target="_blank">website</a>.  The standard-Rails-ish &#8220;look, Mom!  No code!&#8221; type of tutorial.  Just enough to convince you to download it, but not enough to get you to be significantly productive.  <img src='http://www.alsonkemp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </li>
    <li>Adam Stark is providing some greatly needed polish   <a href="http://github.com/llamadonica/turbinado/tree">here</a> as he attempts to get this beastie to build.  Turbinado really needs to be easier to build&#8230;</li>
    <li><a href="http://diegoeche.blogspot.com/" target="_blank">Diego Echeverri</a> is doing some work to get Turbinado to work with GHC 6.10 <a href="http://github.com/diegoeche/turbinado/tree" target="_blank">here.</a> I had a difficult time getting my HSP-ish View templates working with 6.10, so I hope Diego can do it.  I&#8217;d greatly prefer to be working with 6.10, but I couldn&#8217;t get there&#8230;</li>
</ul>

<p>Writing a little web framework turns out to be a lot of work (it&#8217;s all the little stuff (documentation!!) that really gets ya).  I&#8217;ve greatly appreciated the ability to build on the work of others (especially <a href="http://www.cs.chalmers.se/~d00nibro/" target="_blank">Niklas Broberg</a>, <a href="http://www.cse.unsw.edu.au/~dons/" target="_blank">Don Stewart</a>, <a href="http://www.cs.chalmers.se/~bringert/" target="_blank">Bjorn Bringert</a> and <a href="http://www.complete.org/jgoerzen/" target="_blank">John Goerzen</a>) and am grateful that others are providing help to this fledgling project.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.alsonkemp.com/haskell/turbinado-update/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>GitHub, &#8216;git&#8217; and the forking fallacy</title>
		<link>http://www.alsonkemp.com/haskell/github-git-and-the-forking-fallacy/</link>
		<comments>http://www.alsonkemp.com/haskell/github-git-and-the-forking-fallacy/#comments</comments>
		<pubDate>Thu, 18 Dec 2008 05:04:43 +0000</pubDate>
		<dc:creator>alson</dc:creator>
				<category><![CDATA[Geekery]]></category>
		<category><![CDATA[Haskell]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.alsonkemp.com/?p=134</guid>
		<description><![CDATA[GitHub is a pretty sweet system.  One of the best aspects of web 2.0 has been the focus on simple, straightforward web app usability/utility.  GitHub is a great example of some of web 2.0&#8217;s best attributes: a really interesting model coupled with straightforward usability and just a touch of AJAX.  I never would have [...]]]></description>
			<content:encoded><![CDATA[<p><a href="www.github.com">GitHub</a> is a pretty sweet system.  One of the best aspects of <em>web 2.0</em> has been the focus on simple, straightforward web app usability/utility.  <a href="www.github.com">GitHub</a> is a great example of some of <em>web 2.0&#8217;s</em> best attributes: a really interesting model coupled with straightforward usability and <em>just a touch</em> of AJAX.  I never would have tried <a href="http://git.or.cz">Git</a> without  <a href="www.github.com">GitHub</a>.</p>

<p><a href="http://git.or.cz">Git</a> is pretty interesting, too.  Turns out that <a href="http://git.or.cz">git</a> is effective at encouraging social involvement in coding.  The <a href="www.turbinado.org">Turbinado</a> project has been forked a few times&#8230;  &#8216;Forked&#8217;?!  Wait!  That&#8217;s what happens when <a href="http://en.wikipedia.org/wiki/XFree86">projects</a> are in deep trouble, right?!</p>

<p>Maybe so, but not necessarily in <a href="http://git.or.cz">git</a>.  Since <a href="http://git.or.cz">git</a> is a decentralized revision control system (like our beloved <a href="darcs.net/">darcs</a>), &#8216;forking&#8217; is roughly equivalent to &#8216;checking out&#8217;. A &#8216;fork&#8217; is a good thing, so Rails&#8217; fork count (<strong>398</strong>) is <strong>heroic</strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.alsonkemp.com/haskell/github-git-and-the-forking-fallacy/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Thinking About Haskell*: You Know Lazy Evaluation; You Just Don&#8217;t Know It</title>
		<link>http://www.alsonkemp.com/haskell/thinking-about-haskell-you-know-lazy-evaluation-you-just-dont-know-it/</link>
		<comments>http://www.alsonkemp.com/haskell/thinking-about-haskell-you-know-lazy-evaluation-you-just-dont-know-it/#comments</comments>
		<pubDate>Tue, 16 Dec 2008 05:33:06 +0000</pubDate>
		<dc:creator>alson</dc:creator>
				<category><![CDATA[Geekery]]></category>
		<category><![CDATA[Haskell]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Lazy Evaluation]]></category>

		<guid isPermaLink="false">http://www.alsonkemp.com/?p=110</guid>
		<description><![CDATA[[Post updated to reflect comments.  ...too much late night typing...]
Lazy evaluation is a very novel aspect of Haskell.  Turns out that it&#8217;s not that difficult to think about.

A very common example of lazy-ish evaluation is &#8216;&#38;&#38;&#8217; operators used in lots of languages (using C#):


if &#40; &#40;obj != null&#41; &#38;&#38; &#40;obj.someMethod&#40;&#41; == somethingElse&#41; &#41; [...]]]></description>
			<content:encoded><![CDATA[<p>[Post updated to reflect comments.  ...too much late night typing...]
Lazy evaluation is a very novel aspect of Haskell.  Turns out that it&#8217;s not that difficult to think about.</p>

<p>A very common example of lazy-ish evaluation is &#8216;&amp;&amp;&#8217; operators used in lots of languages (using C#):</p>


<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#40;</span>obj <span style="color: #008000;">!=</span> <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">&amp;&amp;</span> <span style="color: #000000;">&#40;</span>obj.<span style="color: #0000FF;">someMethod</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">==</span> somethingElse<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
  <span style="color: #008080; font-style: italic;">// do something</span>
<span style="color: #000000;">&#125;</span></pre></div></div>


<p><span id="more-110"></span></p>

<p><em>obj.someMethod</em> isn&#8217;t evaluated unless <em>obj != null</em>.  So <em>&amp;&amp;</em>, a C# function/operator everyone knows and loves, is strict in its first parameter and lazy in its second.  The previous code might act a little like the following:</p>


<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>obj <span style="color: #008000;">!=</span> <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
  <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>obj.<span style="color: #0000FF;">someMethod</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">==</span> somethingElse<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
    <span style="color: #008080; font-style: italic;">// do something</span>
  <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>


<p>If <em>&amp;&amp;</em> were strict in both parameters, then it&#8217;d throw errors when the second parameter was unconditionally evaluated (e.g. <em>null.someMethod()).  If _&amp;&amp;</em> weren&#8217;t lazy, it might act something like:</p>


<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">condition1 <span style="color: #008000;">=</span> <span style="color: #000000;">&#40;</span>obj <span style="color: #008000;">!=</span> <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
condition2 <span style="color: #008000;">=</span> <span style="color: #000000;">&#40;</span>obj.<span style="color: #0000FF;">someMethod</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">==</span> somethingElse<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>condition1 <span style="color: #008000;">&amp;&amp;</span> condition2<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
    <span style="color: #008080; font-style: italic;">// do something</span>
  <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>


<p>Clearly, <em>condition2</em> would throw an Exception when <em>obj</em> was null, so the <em>if</em> statement must not be evaluating the second parameter.  It&#8217;s as if it were lazy&#8230;</p>

<p>Here&#8217;s the (slightly revised for clarity) definition of <em>&amp;&amp;</em> from Haskell:</p>


<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;"><span style="color: green;">&#40;</span><span style="color: #339933; font-weight: bold;">&amp;&amp;</span><span style="color: green;">&#41;</span>                    <span style="color: #339933; font-weight: bold;">::</span> <span style="color: #cccc00; font-weight: bold;">Bool</span> <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="color: #cccc00; font-weight: bold;">Bool</span> <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="color: #cccc00; font-weight: bold;">Bool</span>
<span style="color: green;">&#40;</span><span style="color: #339933; font-weight: bold;">&amp;&amp;</span><span style="color: green;">&#41;</span> True x              <span style="color: #339933; font-weight: bold;">=</span>  x
<span style="color: green;">&#40;</span><span style="color: #339933; font-weight: bold;">&amp;&amp;</span><span style="color: green;">&#41;</span> False <span style="color: #339933; font-weight: bold;">_</span>             <span style="color: #339933; font-weight: bold;">=</span>  False</pre></div></div>


<p>Just as with C#, the first parameter (<em>x</em>) must be evaluated, but the second parameter is only evaluated if the first parameter is True.  <em>&amp;&amp;</em> is <em>strict</em> in the first parameter and <em>lazy</em> in the second.</p>

<h3>And That&#8217;s All There Is to Laziness?</h3>

<p>Nope.  It&#8217;s &#8220;turtles all the way down&#8221;.</p>

<p>Laziness is a defining feature of Haskell and a feature that separates Haskell from the vast majority of languages.  Lazy evaluation isn&#8217;t confined to a few operators in Haskell; lazy evaluation starts at the first function/expression in your program and continues all the way down.</p>

<p>For more reading, check out <a href="http://www.haskell.org/haskellwiki/Haskell/Lazy_evaluation">here</a>, <a href="http://en.wikipedia.org/wiki/Lazy_evaluation">here</a>, <a href="http://neilmitchell.blogspot.com/2008/03/lazy-evaluation-strict-vs-speculative.html">here</a> and <a href="http://www.google.com/search?q=lazy+evaluation+haskell&#038;ie=utf-8&#038;oe=utf-8&#038;aq=t&#038;rls=org.mozilla:en-US:official&#038;client=firefox-a">here</a>.</p>

<h3>But I Don&#8217;t Want To Be Lazy</h3>

<p>[Example fixed.]
Then force evaluation of your parameters.  How?  One way is to use the <em>$!</em> function to force the evaluation of parameters.</p>


<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;">f a b c <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>someFunction <span style="color: #339933; font-weight: bold;">$!</span> a<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">$!</span> b<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">$!</span> c</pre></div></div>


<p>See <a href="http://www.haskell.org/haskellwiki/Performance/Strictness">here</a> for more.</p>

<hr />

<p>&#42; These little bits have helped me think about Haskell.  Maybe they&#8217;ll be useful for you, too.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.alsonkemp.com/haskell/thinking-about-haskell-you-know-lazy-evaluation-you-just-dont-know-it/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>A HAML parser for Haskell</title>
		<link>http://www.alsonkemp.com/programming/a-haml-parser-for-haskell/</link>
		<comments>http://www.alsonkemp.com/programming/a-haml-parser-for-haskell/#comments</comments>
		<pubDate>Thu, 11 Dec 2008 05:56:30 +0000</pubDate>
		<dc:creator>alson</dc:creator>
				<category><![CDATA[Geekery]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[HAML]]></category>
		<category><![CDATA[Haskell]]></category>
		<category><![CDATA[Turbinado]]></category>

		<guid isPermaLink="false">http://www.alsonkemp.com/?p=74</guid>
		<description><![CDATA[HAML&#8217;s lovely.  As I&#8217;ve been working with Turbinado,  I&#8217;ve been having some issues with HSP.  HSP is an insanely impressive piece of software, but its error messages can be a bit unclear.   So I started playing around a bit with HAML.  Got me wondering &#8220;How easy would be to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://haml.hamptoncatlin.com/">HAML</a>&#8217;s lovely.  As I&#8217;ve been working with <a href="http://www.turbinado.org">Turbinado, </a> I&#8217;ve been having some issues with <a href="http://www.cs.chalmers.se/~d00nibro/hsp/">HSP</a>.  HSP is an insanely impressive piece of software, but its error messages can be a bit unclear.   So I started playing around a bit with HAML.  Got me wondering &#8220;How easy would be to write a HAML parser in Haskell?&#8221;</p>

<p>So I tried.  Here&#8217;s a first-pass, to-be-updated [and somewhat incomplete] HAML parser for Haskell. Not all of the features are implemented, but it&#8217;s a start.  It generates <a title="HTML" href="http://hackage.haskell.org/cgi-bin/hackage-scripts/package/xhtml-3000.2.0.1">HTML</a> bits suitable for compilation by GHC.</p>

<h2>Input</h2>


<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;">f <span style="color: #339933; font-weight: bold;">=</span> content
&nbsp;
page <span style="color: #339933; font-weight: bold;">=</span> #content
         <span style="color: #339933; font-weight: bold;">.</span>left<span style="color: #339933; font-weight: bold;">.</span>column
         <span style="color: #339933; font-weight: bold;">%</span>h2 Welcome to our site<span style="color: #339933; font-weight: bold;">!</span>
         <span style="color: #339933; font-weight: bold;">%</span>p <span style="color: #339933; font-weight: bold;">=</span> print<span style="color: #339933; font-weight: bold;">_</span>information
         <span style="color: #339933; font-weight: bold;">%</span>p
           <span style="color: #339933; font-weight: bold;">=</span> print<span style="color: #339933; font-weight: bold;">_</span>inline
         <span style="color: #339933; font-weight: bold;">.</span>right<span style="color: #339933; font-weight: bold;">.</span>column
           <span style="color: #339933; font-weight: bold;">=</span> render
         <span style="color: green;">&#91;</span>abba <span style="color: #339933; font-weight: bold;">=</span> ding<span style="color: #339933; font-weight: bold;">,</span> ding <span style="color: #339933; font-weight: bold;">=</span> abba<span style="color: green;">&#93;</span> dinger</pre></div></div>


<h2>Output</h2>


<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;">f <span style="color: #339933; font-weight: bold;">=</span>
    <span style="color: green;">&#40;</span>stringToHtml <span style="background-color: #3cb371;">&quot;content&quot;</span><span style="color: green;">&#41;</span>
page <span style="color: #339933; font-weight: bold;">=</span>
       <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>tag <span style="background-color: #3cb371;">&quot;div&quot;</span><span style="color: #339933; font-weight: bold;">!</span><span style="color: green;">&#91;</span>strAttr <span style="background-color: #3cb371;">&quot;id&quot;</span> <span style="background-color: #3cb371;">&quot;content&quot;</span><span style="color: green;">&#93;</span><span style="color: green;">&#41;</span>
         <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>tag <span style="background-color: #3cb371;">&quot;div&quot;</span><span style="color: #339933; font-weight: bold;">!</span><span style="color: green;">&#91;</span>strAttr <span style="background-color: #3cb371;">&quot;class&quot;</span> <span style="background-color: #3cb371;">&quot;left column&quot;</span><span style="color: green;">&#93;</span><span style="color: green;">&#41;</span>
         <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>tag <span style="background-color: #3cb371;">&quot;h2&quot;</span><span style="color: green;">&#41;</span>
             <span style="color: green;">&#40;</span>stringToHtml <span style="background-color: #3cb371;">&quot;Welcome to our site!&quot;</span><span style="color: green;">&#41;</span>
         <span style="color: green;">&#41;</span>
         <span style="color: #339933; font-weight: bold;">+++</span>
         <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>tag <span style="background-color: #3cb371;">&quot;p&quot;</span><span style="color: green;">&#41;</span>
            <span style="color: green;">&#40;</span>stringToHtml print<span style="color: #339933; font-weight: bold;">_</span>information<span style="color: green;">&#41;</span>
         <span style="color: green;">&#41;</span>
         <span style="color: #339933; font-weight: bold;">+++</span>
         <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>tag <span style="background-color: #3cb371;">&quot;p&quot;</span><span style="color: green;">&#41;</span>
           <span style="color: green;">&#40;</span>stringToHtml print<span style="color: #339933; font-weight: bold;">_</span>inline<span style="color: green;">&#41;</span>
         <span style="color: green;">&#41;</span>
         <span style="color: #339933; font-weight: bold;">+++</span>
         <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>tag <span style="background-color: #3cb371;">&quot;div&quot;</span><span style="color: #339933; font-weight: bold;">!</span><span style="color: green;">&#91;</span>strAttr <span style="background-color: #3cb371;">&quot;class&quot;</span> <span style="background-color: #3cb371;">&quot;right column&quot;</span><span style="color: green;">&#93;</span><span style="color: green;">&#41;</span>
           <span style="color: green;">&#40;</span>stringToHtml render<span style="color: green;">&#41;</span>
         <span style="color: green;">&#41;</span>
         <span style="color: #339933; font-weight: bold;">+++</span>
         <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>tag <span style="background-color: #3cb371;">&quot;div&quot;</span><span style="color: #339933; font-weight: bold;">!</span><span style="color: green;">&#91;</span>strAttr <span style="background-color: #3cb371;">&quot;abba&quot;</span> <span style="background-color: #3cb371;">&quot;ding&quot;</span><span style="color: #339933; font-weight: bold;">,</span> strAttr <span style="background-color: #3cb371;">&quot;ding&quot;</span> <span style="background-color: #3cb371;">&quot;abba&quot;</span><span style="color: green;">&#93;</span><span style="color: green;">&#41;</span>
                                    <span style="color: green;">&#40;</span>stringToHtml <span style="background-color: #3cb371;">&quot;dinger&quot;</span><span style="color: green;">&#41;</span>
         <span style="color: green;">&#41;</span>
         <span style="color: green;">&#41;</span>
       <span style="color: green;">&#41;</span></pre></div></div>


<h2>le Code</h2>


<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;"><span style="color: #06c; font-weight: bold;">module</span> Main <span style="color: #06c; font-weight: bold;">where</span>
&nbsp;
<span style="color: #06c; font-weight: bold;">import</span> Text<span style="color: #339933; font-weight: bold;">.</span>ParserCombinators<span style="color: #339933; font-weight: bold;">.</span>Parsec
<span style="color: #06c; font-weight: bold;">import</span> Text<span style="color: #339933; font-weight: bold;">.</span>ParserCombinators<span style="color: #339933; font-weight: bold;">.</span>Parsec<span style="color: #339933; font-weight: bold;">.</span>Language
<span style="color: #06c; font-weight: bold;">import</span> Text<span style="color: #339933; font-weight: bold;">.</span>ParserCombinators<span style="color: #339933; font-weight: bold;">.</span>Parsec<span style="color: #339933; font-weight: bold;">.</span>Pos
<span style="color: #06c; font-weight: bold;">import</span> <span style="color: #06c; font-weight: bold;">qualified</span> Text<span style="color: #339933; font-weight: bold;">.</span>ParserCombinators<span style="color: #339933; font-weight: bold;">.</span>Parsec<span style="color: #339933; font-weight: bold;">.</span>Token <span style="color: #06c; font-weight: bold;">as</span> T
<span style="color: #06c; font-weight: bold;">import</span> Data<span style="color: #339933; font-weight: bold;">.</span><span style="color: #cccc00; font-weight: bold;">Char</span>
<span style="color: #06c; font-weight: bold;">import</span> Data<span style="color: #339933; font-weight: bold;">.</span>List
<span style="color: #06c; font-weight: bold;">import</span> Data<span style="color: #339933; font-weight: bold;">.</span><span style="color: #cccc00; font-weight: bold;">Maybe</span>
<span style="color: #06c; font-weight: bold;">import</span> System<span style="color: #339933; font-weight: bold;">.</span><span style="color: #cccc00; font-weight: bold;">IO</span><span style="color: #339933; font-weight: bold;">.</span>Unsafe
&nbsp;
main <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #06c; font-weight: bold;">do</span> s <span style="color: #339933; font-weight: bold;">&lt;-</span> <span style="font-weight: bold;">getContents</span>
          <span style="color: #06c; font-weight: bold;">case</span> <span style="color: green;">&#40;</span>parse mainParser <span style="background-color: #3cb371;">&quot;stdin&quot;</span> s<span style="color: green;">&#41;</span> <span style="color: #06c; font-weight: bold;">of</span>
            Left  err <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="font-weight: bold;">putStrLn</span> <span style="background-color: #3cb371;">&quot;Error: &quot;</span> <span style="color: #339933; font-weight: bold;">&gt;&gt;</span> <span style="font-weight: bold;">print</span> err
            Right hs  <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="font-weight: bold;">putStrLn</span> hs
&nbsp;
<span style="color: #5d478b; font-style: italic;">-- Try to parse HAML, otherwise re-output raw lines</span>
&nbsp;
mainParser <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #06c; font-weight: bold;">do</span> whiteSpace
                ls <span style="color: #339933; font-weight: bold;">&lt;-</span> many1 <span style="color: green;">&#40;</span>hamlCode <span style="color: #339933; font-weight: bold;">&lt;|&gt;</span> tilEOL<span style="color: green;">&#41;</span>
                <span style="font-weight: bold;">return</span> <span style="color: #339933; font-weight: bold;">$</span> <span style="font-weight: bold;">unlines</span> ls
<span style="color: #5d478b; font-style: italic;">--</span>
<span style="color: #5d478b; font-style: italic;">-- * HAML lexer</span>
<span style="color: #5d478b; font-style: italic;">--</span>
hamlLexer <span style="color: #339933; font-weight: bold;">=</span> T<span style="color: #339933; font-weight: bold;">.</span>makeTokenParser emptyDef
whiteSpace<span style="color: #339933; font-weight: bold;">=</span> T<span style="color: #339933; font-weight: bold;">.</span>whiteSpace hamlLexer
lexeme    <span style="color: #339933; font-weight: bold;">=</span> T<span style="color: #339933; font-weight: bold;">.</span>lexeme hamlLexer
symbol    <span style="color: #339933; font-weight: bold;">=</span> T<span style="color: #339933; font-weight: bold;">.</span>symbol hamlLexer
natural   <span style="color: #339933; font-weight: bold;">=</span> T<span style="color: #339933; font-weight: bold;">.</span>natural hamlLexer
parens    <span style="color: #339933; font-weight: bold;">=</span> T<span style="color: #339933; font-weight: bold;">.</span>parens hamlLexer
semi      <span style="color: #339933; font-weight: bold;">=</span> T<span style="color: #339933; font-weight: bold;">.</span>semi hamlLexer
squares   <span style="color: #339933; font-weight: bold;">=</span> T<span style="color: #339933; font-weight: bold;">.</span>squares hamlLexer
stringLiteral<span style="color: #339933; font-weight: bold;">=</span> T<span style="color: #339933; font-weight: bold;">.</span>stringLiteral hamlLexer
identifier<span style="color: #339933; font-weight: bold;">=</span> T<span style="color: #339933; font-weight: bold;">.</span>identifier hamlLexer
reserved  <span style="color: #339933; font-weight: bold;">=</span> T<span style="color: #339933; font-weight: bold;">.</span>reserved hamlLexer
reservedOp<span style="color: #339933; font-weight: bold;">=</span> T<span style="color: #339933; font-weight: bold;">.</span>reservedOp hamlLexer
commaSep1 <span style="color: #339933; font-weight: bold;">=</span> T<span style="color: #339933; font-weight: bold;">.</span>commaSep1 hamlLexer
<span style="color: #5d478b; font-style: italic;">--</span>
<span style="color: #5d478b; font-style: italic;">-- * Main HAML parsers</span>
<span style="color: #5d478b; font-style: italic;">--</span>
&nbsp;
<span style="color: #5d478b; font-style: italic;">-- hamlCode is just many identifiers (e.g. 'func a b c' followed by '=' followed by a hamlBlock</span>
<span style="color: #5d478b; font-style: italic;">-- func a b c = %somehaml</span>
hamlCode <span style="color: #339933; font-weight: bold;">=</span> try <span style="color: green;">&#40;</span> <span style="color: #06c; font-weight: bold;">do</span> is <span style="color: #339933; font-weight: bold;">&lt;-</span> many1 identifier
                    symbol <span style="background-color: #3cb371;">&quot;=&quot;</span>
                    currentPos <span style="color: #339933; font-weight: bold;">&lt;-</span> getPosition
                    x <span style="color: #339933; font-weight: bold;">&lt;-</span> manyTill1
                          <span style="color: green;">&#40;</span>lexeme <span style="color: #339933; font-weight: bold;">$</span> hamlBlock<span style="color: green;">&#41;</span>
                          <span style="color: green;">&#40;</span>notSameIndent currentPos<span style="color: green;">&#41;</span>
                    <span style="font-weight: bold;">return</span> <span style="color: #339933; font-weight: bold;">$</span> <span style="color: green;">&#40;</span><span style="font-weight: bold;">concat</span> <span style="color: #339933; font-weight: bold;">$</span> intersperse <span style="background-color: #3cb371;">&quot; &quot;</span> is<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">++</span>
                             <span style="background-color: #3cb371;">&quot; = <span style="background-color: #3cb371; font-weight: bold;">\n</span>&quot;</span> <span style="color: #339933; font-weight: bold;">++</span>
                             <span style="color: green;">&#40;</span><span style="font-weight: bold;">concat</span> <span style="color: #339933; font-weight: bold;">$</span> <span style="color: green;">&#40;</span>intersperse <span style="color: green;">&#40;</span>indent currentPos <span style="color: #339933; font-weight: bold;">++</span> <span style="background-color: #3cb371;">&quot;+++<span style="background-color: #3cb371; font-weight: bold;">\n</span>&quot;</span><span style="color: green;">&#41;</span>  <span style="color: #339933; font-weight: bold;">$</span> <span style="font-weight: bold;">filter</span> <span style="color: green;">&#40;</span><span style="font-weight: bold;">not</span> <span style="color: #339933; font-weight: bold;">.</span> <span style="font-weight: bold;">null</span><span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">$</span> x<span style="color: green;">&#41;</span><span style="color: green;">&#41;</span>
                  <span style="color: green;">&#41;</span>
&nbsp;
<span style="color: #5d478b; font-style: italic;">-- A Block may start with some whitespace, then has a valid bit of data</span>
hamlBlock   <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #06c; font-weight: bold;">do</span> currentPos <span style="color: #339933; font-weight: bold;">&lt;-</span> getPosition
                 bs <span style="color: #339933; font-weight: bold;">&lt;-</span> manyTill1
                      <span style="color: green;">&#40;</span>pTag <span style="color: #339933; font-weight: bold;">&lt;|&gt;</span> pText<span style="color: green;">&#41;</span>
                      <span style="color: green;">&#40;</span>notSameIndent currentPos<span style="color: green;">&#41;</span>
                 <span style="font-weight: bold;">return</span> <span style="color: #339933; font-weight: bold;">$</span> intercalate <span style="color: green;">&#40;</span>indent currentPos <span style="color: #339933; font-weight: bold;">++</span> <span style="background-color: #3cb371;">&quot;+++<span style="background-color: #3cb371; font-weight: bold;">\n</span>&quot;</span><span style="color: green;">&#41;</span> bs
&nbsp;
pTag    <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #06c; font-weight: bold;">do</span>    currentPos <span style="color: #339933; font-weight: bold;">&lt;-</span> getPosition
                try
                    <span style="color: green;">&#40;</span><span style="color: #06c; font-weight: bold;">do</span> t  <span style="color: #339933; font-weight: bold;">&lt;-</span> lexeme tagParser
                        ts <span style="color: #339933; font-weight: bold;">&lt;-</span> <span style="color: green;">&#40;</span>isInline currentPos <span style="color: #339933; font-weight: bold;">&gt;&gt;</span> char '<span style="color: #339933; font-weight: bold;">/</span>' <span style="color: #339933; font-weight: bold;">&gt;&gt;</span> <span style="font-weight: bold;">return</span> <span style="color: green;">&#91;</span><span style="color: green;">&#93;</span><span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">&lt;|&gt;</span>
                              <span style="color: green;">&#40;</span>hamlBlock<span style="color: green;">&#41;</span>
                        <span style="font-weight: bold;">return</span> <span style="color: #339933; font-weight: bold;">$</span> intercalate <span style="background-color: #3cb371;">&quot;<span style="background-color: #3cb371; font-weight: bold;">\n</span>&quot;</span> <span style="color: #339933; font-weight: bold;">$</span> <span style="font-weight: bold;">filter</span> <span style="color: green;">&#40;</span><span style="font-weight: bold;">not</span> <span style="color: #339933; font-weight: bold;">.</span> <span style="font-weight: bold;">null</span><span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">$</span>
                          <span style="color: green;">&#91;</span> <span style="color: green;">&#40;</span>indent currentPos<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">++</span> <span style="background-color: #3cb371;">&quot;((&quot;</span> <span style="color: #339933; font-weight: bold;">++</span> <span style="color: green;">&#40;</span><span style="color: #06c; font-weight: bold;">if</span> <span style="color: green;">&#40;</span><span style="font-weight: bold;">null</span> ts<span style="color: green;">&#41;</span> <span style="color: #06c; font-weight: bold;">then</span> <span style="background-color: #3cb371;">&quot;i&quot;</span> <span style="color: #06c; font-weight: bold;">else</span> <span style="background-color: #3cb371;">&quot;&quot;</span><span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">++</span> t  <span style="color: #339933; font-weight: bold;">++</span> <span style="background-color: #3cb371;">&quot;)&quot;</span>
                          <span style="color: #339933; font-weight: bold;">,</span> <span style="color: #06c; font-weight: bold;">if</span> <span style="font-weight: bold;">null</span> ts <span style="color: #06c; font-weight: bold;">then</span> <span style="color: green;">&#91;</span><span style="color: green;">&#93;</span> <span style="color: #06c; font-weight: bold;">else</span> ts
                          <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span>indent currentPos<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">++</span> <span style="background-color: #3cb371;">&quot;)<span style="background-color: #3cb371; font-weight: bold;">\n</span>&quot;</span><span style="color: green;">&#93;</span>
                    <span style="color: green;">&#41;</span>
&nbsp;
pText <span style="color: #339933; font-weight: bold;">=</span> lexeme stringParser
&nbsp;
notSameIndent p <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#40;</span>eof <span style="color: #339933; font-weight: bold;">&gt;&gt;</span> <span style="font-weight: bold;">return</span> <span style="color: green;">&#91;</span><span style="color: green;">&#93;</span><span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">&lt;|&gt;</span>
                  <span style="color: green;">&#40;</span><span style="color: #06c; font-weight: bold;">do</span> innerPos <span style="color: #339933; font-weight: bold;">&lt;-</span> getPosition
                      <span style="color: #06c; font-weight: bold;">case</span> <span style="color: green;">&#40;</span>sourceColumn p<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">==</span> <span style="color: green;">&#40;</span>sourceColumn innerPos<span style="color: green;">&#41;</span> <span style="color: #06c; font-weight: bold;">of</span>
                                True  <span style="color: #339933; font-weight: bold;">-&gt;</span> pzero
                                False <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="font-weight: bold;">return</span> <span style="color: green;">&#91;</span><span style="color: green;">&#93;</span>
                  <span style="color: green;">&#41;</span>
&nbsp;
<span style="color: #5d478b; font-style: italic;">--</span>
<span style="color: #5d478b; font-style: italic;">-- * Various little parsers</span>
<span style="color: #5d478b; font-style: italic;">--</span>
&nbsp;
tagParser <span style="color: #339933; font-weight: bold;">::</span> CharParser <span style="color: green;">&#40;</span><span style="color: green;">&#41;</span> <span style="color: #cccc00; font-weight: bold;">String</span>
tagParser <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #06c; font-weight: bold;">do</span>     t <span style="color: #339933; font-weight: bold;">&lt;-</span> optionMaybe tagParser'
                   i <span style="color: #339933; font-weight: bold;">&lt;-</span> optionMaybe idParser
                   c <span style="color: #339933; font-weight: bold;">&lt;-</span> optionMaybe <span style="color: green;">&#40;</span>many1 classParser<span style="color: green;">&#41;</span>
                   a <span style="color: #339933; font-weight: bold;">&lt;-</span> optionMaybe attributesParser
                   <span style="color: #06c; font-weight: bold;">if</span> <span style="color: green;">&#40;</span>isJust t <span style="color: #339933; font-weight: bold;">||</span> isJust i <span style="color: #339933; font-weight: bold;">||</span> isJust c <span style="color: #339933; font-weight: bold;">||</span> isJust a<span style="color: green;">&#41;</span>
                     <span style="color: #06c; font-weight: bold;">then</span>
                       <span style="color: #06c; font-weight: bold;">do</span> <span style="font-weight: bold;">return</span> <span style="color: #339933; font-weight: bold;">$</span> <span style="background-color: #3cb371;">&quot;tag <span style="background-color: #3cb371; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #339933; font-weight: bold;">++</span> <span style="color: green;">&#40;</span>fromMaybe <span style="background-color: #3cb371;">&quot;div&quot;</span> t<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">++</span> <span style="background-color: #3cb371;">&quot;<span style="background-color: #3cb371; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #339933; font-weight: bold;">++</span>
                           <span style="color: green;">&#40;</span><span style="color: #06c; font-weight: bold;">if</span> <span style="font-weight: bold;">not</span> <span style="color: green;">&#40;</span>isJust i <span style="color: #339933; font-weight: bold;">||</span> isJust c <span style="color: #339933; font-weight: bold;">||</span> isJust a<span style="color: green;">&#41;</span> <span style="color: #06c; font-weight: bold;">then</span> <span style="background-color: #3cb371;">&quot;&quot;</span> <span style="color: #06c; font-weight: bold;">else</span>
                              <span style="font-weight: bold;">concat</span> <span style="color: #339933; font-weight: bold;">$</span>
                               <span style="color: green;">&#91;</span> <span style="background-color: #3cb371;">&quot;![&quot;</span>
                               <span style="color: #339933; font-weight: bold;">,</span> intercalate <span style="background-color: #3cb371;">&quot;, &quot;</span> <span style="color: #339933; font-weight: bold;">$</span> <span style="font-weight: bold;">filter</span> <span style="color: green;">&#40;</span><span style="font-weight: bold;">not</span> <span style="color: #339933; font-weight: bold;">.</span> <span style="font-weight: bold;">null</span><span style="color: green;">&#41;</span>
                                   <span style="color: green;">&#91;</span> <span style="color: green;">&#40;</span><span style="font-weight: bold;">maybe</span> <span style="background-color: #3cb371;">&quot;&quot;</span> <span style="color: green;">&#40;</span>\i' <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="background-color: #3cb371;">&quot;strAttr <span style="background-color: #3cb371; font-weight: bold;">\&quot;</span>id<span style="background-color: #3cb371; font-weight: bold;">\&quot;</span> <span style="background-color: #3cb371; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #339933; font-weight: bold;">++</span> i' <span style="color: #339933; font-weight: bold;">++</span> <span style="background-color: #3cb371;">&quot;<span style="background-color: #3cb371; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: green;">&#41;</span> i<span style="color: green;">&#41;</span>
                                   <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="font-weight: bold;">maybe</span> <span style="background-color: #3cb371;">&quot;&quot;</span> <span style="color: green;">&#40;</span>\c' <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="background-color: #3cb371;">&quot;strAttr <span style="background-color: #3cb371; font-weight: bold;">\&quot;</span>class<span style="background-color: #3cb371; font-weight: bold;">\&quot;</span> <span style="background-color: #3cb371; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #339933; font-weight: bold;">++</span> <span style="color: green;">&#40;</span>intercalate <span style="background-color: #3cb371;">&quot; &quot;</span> c'<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">++</span> <span style="background-color: #3cb371;">&quot;<span style="background-color: #3cb371; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: green;">&#41;</span> c<span style="color: green;">&#41;</span>
                                   <span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#40;</span><span style="font-weight: bold;">maybe</span> <span style="background-color: #3cb371;">&quot;&quot;</span> <span style="color: green;">&#40;</span>\kv <span style="color: #339933; font-weight: bold;">-&gt;</span> intercalate <span style="background-color: #3cb371;">&quot;, &quot;</span> <span style="color: #339933; font-weight: bold;">$</span> <span style="font-weight: bold;">map</span> <span style="color: green;">&#40;</span>\<span style="color: green;">&#40;</span>k<span style="color: #339933; font-weight: bold;">,</span>v<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="background-color: #3cb371;">&quot;strAttr <span style="background-color: #3cb371; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #339933; font-weight: bold;">++</span> k <span style="color: #339933; font-weight: bold;">++</span> <span style="background-color: #3cb371;">&quot;<span style="background-color: #3cb371; font-weight: bold;">\&quot;</span> <span style="background-color: #3cb371; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #339933; font-weight: bold;">++</span> v <span style="color: #339933; font-weight: bold;">++</span> <span style="background-color: #3cb371;">&quot;<span style="background-color: #3cb371; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: green;">&#41;</span> kv<span style="color: green;">&#41;</span> a<span style="color: green;">&#41;</span>
                                   <span style="color: green;">&#93;</span>
                               <span style="color: #339933; font-weight: bold;">,</span> <span style="background-color: #3cb371;">&quot;]&quot;</span><span style="color: green;">&#93;</span>
                           <span style="color: green;">&#41;</span>
                     <span style="color: #06c; font-weight: bold;">else</span> pzero
&nbsp;
tagParser' <span style="color: #339933; font-weight: bold;">::</span> CharParser <span style="color: green;">&#40;</span><span style="color: green;">&#41;</span> <span style="color: #cccc00; font-weight: bold;">String</span>
tagParser' <span style="color: #339933; font-weight: bold;">=</span>  <span style="color: #06c; font-weight: bold;">do</span> char '<span style="color: #339933; font-weight: bold;">%</span>'
                 many1 termChar
&nbsp;
idParser <span style="color: #339933; font-weight: bold;">::</span> CharParser <span style="color: green;">&#40;</span><span style="color: green;">&#41;</span> <span style="color: #cccc00; font-weight: bold;">String</span>
idParser <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #06c; font-weight: bold;">do</span> char '#'
              many1 termChar
&nbsp;
classParser <span style="color: #339933; font-weight: bold;">::</span> CharParser <span style="color: green;">&#40;</span><span style="color: green;">&#41;</span> <span style="color: #cccc00; font-weight: bold;">String</span>
classParser <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #06c; font-weight: bold;">do</span> char '<span style="color: #339933; font-weight: bold;">.</span>'
                 many1 termChar
&nbsp;
attributesParser <span style="color: #339933; font-weight: bold;">::</span> CharParser <span style="color: green;">&#40;</span><span style="color: green;">&#41;</span> <span style="color: green;">&#91;</span><span style="color: green;">&#40;</span><span style="color: #cccc00; font-weight: bold;">String</span><span style="color: #339933; font-weight: bold;">,</span> <span style="color: #cccc00; font-weight: bold;">String</span><span style="color: green;">&#41;</span><span style="color: green;">&#93;</span>
attributesParser <span style="color: #339933; font-weight: bold;">=</span> squares <span style="color: green;">&#40;</span>commaSep1 attributeParser<span style="color: green;">&#41;</span>
&nbsp;
attributeParser <span style="color: #339933; font-weight: bold;">::</span> CharParser <span style="color: green;">&#40;</span><span style="color: green;">&#41;</span> <span style="color: green;">&#40;</span><span style="color: #cccc00; font-weight: bold;">String</span><span style="color: #339933; font-weight: bold;">,</span> <span style="color: #cccc00; font-weight: bold;">String</span><span style="color: green;">&#41;</span>
attributeParser <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #06c; font-weight: bold;">do</span> k <span style="color: #339933; font-weight: bold;">&lt;-</span> identifier
                     symbol <span style="background-color: #3cb371;">&quot;=&quot;</span>
                     cs <span style="color: #339933; font-weight: bold;">&lt;-</span> many1 identifier
                     <span style="font-weight: bold;">return</span> <span style="color: green;">&#40;</span>k<span style="color: #339933; font-weight: bold;">,</span> intercalate <span style="background-color: #3cb371;">&quot; &quot;</span> cs<span style="color: green;">&#41;</span>
&nbsp;
stringParser <span style="color: #339933; font-weight: bold;">::</span> CharParser <span style="color: green;">&#40;</span><span style="color: green;">&#41;</span> <span style="color: #cccc00; font-weight: bold;">String</span>
stringParser <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #06c; font-weight: bold;">do</span>   currentPos <span style="color: #339933; font-weight: bold;">&lt;-</span> getPosition
                    modifier <span style="color: #339933; font-weight: bold;">&lt;-</span> optionMaybe <span style="color: green;">&#40;</span>char '<span style="color: #339933; font-weight: bold;">=</span>' <span style="color: #339933; font-weight: bold;">&lt;|&gt;</span> char '<span style="color: #339933; font-weight: bold;">-</span>'<span style="color: green;">&#41;</span>
                    whiteSpace
                    c <span style="color: #339933; font-weight: bold;">&lt;-</span> alphaNum
                    cs<span style="color: #339933; font-weight: bold;">&lt;-</span> tilEOL
                    <span style="color: #06c; font-weight: bold;">case</span> modifier <span style="color: #06c; font-weight: bold;">of</span>
                      Just '<span style="color: #339933; font-weight: bold;">-</span>' <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="font-weight: bold;">return</span> <span style="color: #339933; font-weight: bold;">$</span> <span style="color: green;">&#40;</span>indent currentPos<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">++</span> <span style="background-color: #3cb371;">&quot;-&quot;</span> <span style="color: #339933; font-weight: bold;">++</span> c:cs
                      Just '<span style="color: #339933; font-weight: bold;">=</span>' <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="font-weight: bold;">return</span> <span style="color: #339933; font-weight: bold;">$</span> <span style="color: green;">&#40;</span>indent currentPos<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">++</span> <span style="background-color: #3cb371;">&quot;(stringToHtml &quot;</span> <span style="color: #339933; font-weight: bold;">++</span> c:cs <span style="color: #339933; font-weight: bold;">++</span> <span style="background-color: #3cb371;">&quot;)&quot;</span>
                      Nothing  <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="font-weight: bold;">return</span> <span style="color: #339933; font-weight: bold;">$</span> <span style="color: green;">&#40;</span>indent currentPos<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">++</span> <span style="background-color: #3cb371;">&quot;(stringToHtml <span style="background-color: #3cb371; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #339933; font-weight: bold;">++</span> c:cs <span style="color: #339933; font-weight: bold;">++</span> <span style="background-color: #3cb371;">&quot;<span style="background-color: #3cb371; font-weight: bold;">\&quot;</span>)&quot;</span>
&nbsp;
<span style="color: #5d478b; font-style: italic;">--</span>
<span style="color: #5d478b; font-style: italic;">-- * Utility functions</span>
<span style="color: #5d478b; font-style: italic;">--</span>
&nbsp;
isInline     p <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #06c; font-weight: bold;">do</span> p2 <span style="color: #339933; font-weight: bold;">&lt;-</span> getPosition
                    <span style="color: #06c; font-weight: bold;">case</span> <span style="color: green;">&#40;</span>sourceLine p  <span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">==</span> <span style="color: green;">&#40;</span>sourceLine p2<span style="color: green;">&#41;</span> <span style="color: #06c; font-weight: bold;">of</span>
                      True <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="font-weight: bold;">return</span> <span style="color: green;">&#91;</span><span style="color: green;">&#93;</span>
                      False <span style="color: #339933; font-weight: bold;">-&gt;</span> pzero
isSameIndent p1 p2 <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#40;</span>sourceColumn p1<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">==</span> <span style="color: green;">&#40;</span>sourceColumn p2<span style="color: green;">&#41;</span>
&nbsp;
tilEOL <span style="color: #339933; font-weight: bold;">=</span> manyTill1 <span style="color: green;">&#40;</span>noneOf <span style="background-color: #3cb371;">&quot;<span style="background-color: #3cb371; font-weight: bold;">\n</span>&quot;</span><span style="color: green;">&#41;</span> eol
eol <span style="color: #339933; font-weight: bold;">=</span> newline <span style="color: #339933; font-weight: bold;">&lt;|&gt;</span> <span style="color: green;">&#40;</span>eof <span style="color: #339933; font-weight: bold;">&gt;&gt;</span> <span style="font-weight: bold;">return</span> '\n'<span style="color: green;">&#41;</span>
&nbsp;
termChar <span style="color: #339933; font-weight: bold;">=</span> satisfy <span style="color: green;">&#40;</span>\c <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="color: green;">&#40;</span>isAlphaNum c<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">||</span> <span style="color: green;">&#40;</span>c `<span style="font-weight: bold;">elem</span>` termPunctuation<span style="color: green;">&#41;</span> <span style="color: green;">&#41;</span>
termPunctuation <span style="color: #339933; font-weight: bold;">=</span> <span style="background-color: #3cb371;">&quot;-_&quot;</span>
indent p <span style="color: #339933; font-weight: bold;">=</span> <span style="font-weight: bold;">take</span> <span style="color: green;">&#40;</span>sourceColumn <span style="color: green;">&#40;</span>p<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">-</span> <span style="color: red;">1</span><span style="color: green;">&#41;</span> <span style="color: green;">&#40;</span><span style="font-weight: bold;">repeat</span> ' '<span style="color: green;">&#41;</span>
&nbsp;
manyTill1 p e <span style="color: #339933; font-weight: bold;">=</span>  <span style="color: #06c; font-weight: bold;">do</span> ms <span style="color: #339933; font-weight: bold;">&lt;-</span> manyTill p e
                    <span style="color: #06c; font-weight: bold;">case</span> <span style="color: green;">&#40;</span><span style="font-weight: bold;">null</span> ms<span style="color: green;">&#41;</span> <span style="color: #06c; font-weight: bold;">of</span>
                      True  <span style="color: #339933; font-weight: bold;">-&gt;</span> pzero
                      False <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="font-weight: bold;">return</span> ms</pre></div></div>


<p>Golly, but I wish that I&#8217;d cleaned up the code, but there it is in all of its raw, un-thought-through glory&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.alsonkemp.com/programming/a-haml-parser-for-haskell/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>ANNOUNCE: Turbinado V0.2 &#8220;Still Ugly&#8221;</title>
		<link>http://www.alsonkemp.com/work/announce-turbinado-v02-still-ugly/</link>
		<comments>http://www.alsonkemp.com/work/announce-turbinado-v02-still-ugly/#comments</comments>
		<pubDate>Wed, 26 Nov 2008 06:11:59 +0000</pubDate>
		<dc:creator>alson</dc:creator>
				<category><![CDATA[Geekery]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby On rails]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://www.alsonkemp.com/?p=86</guid>
		<description><![CDATA[More progress on Turbinado.  Look!  A whole &#8220;+0.1&#8243;!

Progress continues on Turbinado.  Turbinado can be found at:

http://www.turbinado.org

The source can be found at:

http://github.com/alsonkemp/turbinado/tree/master

   (see the /App directory for the code for www.turbinado.org)

New in V0.2:
  * A better "Environment" type (rather than using Dynamics) (-> a 50%
speed boost?  That's unpossible!);
  [...]]]></description>
			<content:encoded><![CDATA[<p>More progress on Turbinado.  Look!  A whole &#8220;+0.1&#8243;!
<pre>
Progress continues on Turbinado.  Turbinado can be found at:

http://www.turbinado.org</p>

<p>The source can be found at:

http://github.com/alsonkemp/turbinado/tree/master

   (see the /App directory for the code for www.turbinado.org)</p>

<p>New in V0.2:
  * A better "Environment" type (rather than using Dynamics) (-> a 50%
speed boost?  That's unpossible!);
  * A functional early version of an ORM for PostgreSQL (note: still
needs to handle updates; hdbc-postgresql has a bug with sensing
nullable columns);
  * A prettier website;
  * Licensing -> BSD.</p>

<p>Expect V0.3 in the next week or so with:
  * More view helpers;
  * An ORM which handles INSERT/UPDATE...;
  * A little CMS built using the ORM.</p>

<p>Future release:
  * Separate the website out from the framework.  For now, they're
evolving together, so live together. 
</pre></p>
]]></content:encoded>
			<wfw:commentRss>http://www.alsonkemp.com/work/announce-turbinado-v02-still-ugly/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ANNOUNCE: Turbinado V0.1</title>
		<link>http://www.alsonkemp.com/ruby-on-rails/announce-turbinado-v01/</link>
		<comments>http://www.alsonkemp.com/ruby-on-rails/announce-turbinado-v01/#comments</comments>
		<pubDate>Tue, 18 Nov 2008 06:10:33 +0000</pubDate>
		<dc:creator>alson</dc:creator>
				<category><![CDATA[Geekery]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby On rails]]></category>
		<category><![CDATA[Turbinado]]></category>

		<guid isPermaLink="false">http://www.alsonkemp.com/?p=81</guid>
		<description><![CDATA[Posted to the Haskell mailing list:
I'd like to announce Turbinado, a very young and raw MVC web framework
for Haskell.  While the framework doesn't exactly copy Ruby on Rails,
it certainly rhymes...  It's very early days for Turbinado, but the
framework is moving along nicely.  There are still issues to be ironed
out and architectural details to be decided, [...]]]></description>
			<content:encoded><![CDATA[<p>Posted to the <a title="Haskell" href="ANNOUNCE: Turbinado V0.1">Haskell</a> mailing list:
<pre>I'd like to announce Turbinado, a very young and raw MVC web framework
for Haskell.  While the framework doesn't exactly copy Ruby on Rails,
it certainly rhymes...  It's very early days for Turbinado, but the
framework is moving along nicely.  There are still issues to be ironed
out and architectural details to be decided, so help/contribution would be
very much appreciated.</p>

<p>Turbinado can be found at:
<a rel="nofollow" href="http://www.turbinado.org/" target="_top">http://www.turbinado.org</a></p>

<p>The source can be found at:
<a rel="nofollow" href="http://github.com/alsonkemp/turbinado/tree/master" target="_top">http://github.com/alsonkemp/turbinado/tree/master</a>
(see the /App directory for the code for www.turbinado.org)</p>

<p>Turbinado:
* Provides a fast web server (based on HSP; see
<a rel="nofollow" href="http://turbinado.org/Home/Performance%29;" target="_top">http://turbinado.org/Home/Performance);</a>
* Provides a straightforward organization for your website (courtesy
of Rails);
* Uses simple HTML-like templating (courtesy of HSX);
* Is easily extensible (courtesy of an Environment built out of <em>Map
String Dynamic</em>, not the most type-safe of beasties; Help!);
* Configurable routing (see Config/Routes.hs).</p>

<p>Turbinado is currently lacking:
* Documentation...
* An easy install...
* A database ORM based on HDBC (visibly incomplete and ugly in
Turbinado/Database/ORM);
* Many more HTML helpers;
* Controllers for partials (lightweight "controls" ala ASP.NET);
* Strong error reporting and handling;
* Lots of functionality and plugins;
* ... the favorite feature that you want to develop for Turbinado ...</pre></p>
]]></content:encoded>
			<wfw:commentRss>http://www.alsonkemp.com/ruby-on-rails/announce-turbinado-v01/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
