<?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/"
	>

<channel>
	<title>therning.org/ magnus</title>
	<atom:link href="http://therning.org/magnus/feed" rel="self" type="application/rss+xml" />
	<link>http://therning.org/magnus</link>
	<description>Incoherent mumblings</description>
	<pubDate>Fri, 03 Jul 2009 09:46:07 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Making a choice from a list in Haskell, Vty (part 1)</title>
		<link>http://therning.org/magnus/archives/685</link>
		<comments>http://therning.org/magnus/archives/685#comments</comments>
		<pubDate>Fri, 03 Jul 2009 09:46:07 +0000</pubDate>
		<dc:creator>Magnus</dc:creator>
		
		<category><![CDATA[Posts]]></category>

		<category><![CDATA[haskell]]></category>

		<category><![CDATA[vty]]></category>

		<guid isPermaLink="false">http://therning.org/magnus/?p=685</guid>
		<description><![CDATA[After posting the zeroth part of this series I realised I hadn&#8217;t said
anything about the final goal of this exercise.  The first post contained code
for choosing one one-line string (String) out of a list of one-line strings
([String]).  What I really want is the ability to choose one item out of a
list of items, [...]]]></description>
			<content:encoded><![CDATA[<p>After posting the <a href="http://therning.org/magnus/archives/664">zeroth part</a> of this series I realised I hadn&#8217;t said
anything about the final goal of this exercise.  The first post contained code
for choosing one one-line string (<code>String</code>) out of a list of one-line strings
(<code>[String]</code>).  What I really want is the ability to choose one item out of a
list of items, where each may render to be multiple lines.  It would also be
really cool if an item could be collapsed and expanded in the rendering.
This is the first step in my journey towards these loosely specified
requriements.</p>

<p>Rendering items into strings sounds like pretty-printing to me, so I played
around a little with a few pretty-printing libraries.  Finally I settled on
the <a href="http://hackage.haskell.org/package/wl-pprint">Wadler/Leijen Pretty Printer</a> (<code>Text.PrettyPrint.Leijen</code>).  I didn&#8217;t
really have any strong reason for choosing it, beyond that it comes with its
own type class whereas the pretty-printing library that ships with GHC
(<code>Text.PrettyPrint.HughesPJ</code>) doesn&#8217;t (though there is a <a href="http://hackage.haskell.org/package/prettyclass">package on
HackageDB</a> with a class for it).</p>

<p>I did the smallest change I could think of to add pretty-printing.  First the
module needs to be imported of course:</p>


<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;"><span style="color: #06c; font-weight: bold;">import</span> Text<span style="color: #339933; font-weight: bold;">.</span>PrettyPrint<span style="color: #339933; font-weight: bold;">.</span>Leijen</pre></div></div>


<p>Then I added a function to turn a list of items into a document (<code>Doc</code>) where
each item is pretty-printed on its own line:</p>


<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;">myPrettyList <span style="color: #339933; font-weight: bold;">::</span> Pretty a <span style="color: #339933; font-weight: bold;">=&gt;</span> <span style="color: green;">&#91;</span>a<span style="color: green;">&#93;</span> <span style="color: #339933; font-weight: bold;">-&gt;</span> Doc
myPrettyList <span style="color: #339933; font-weight: bold;">=</span> vcat <span style="color: #339933; font-weight: bold;">.</span> <span style="font-weight: bold;">map</span> pretty</pre></div></div>


<p>I then decided that <code>_getChoice</code> should be left unchanged and instead modified
<code>getChoice</code> to turn the list of items into a list of strings:</p>


<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;">getChoice vt opts <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #06c; font-weight: bold;">let</span>
        <span style="color: #339933; font-weight: bold;">_</span>converted<span style="color: #339933; font-weight: bold;">_</span>opts <span style="color: #339933; font-weight: bold;">=</span> myPrettyList opts
    <span style="color: #06c; font-weight: bold;">in</span> <span style="color: #06c; font-weight: bold;">do</span>
        <span style="color: green;">&#40;</span>sx<span style="color: #339933; font-weight: bold;">,</span> sy<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">&lt;-</span> getSize vt
        <span style="color: #339933; font-weight: bold;">_</span>getChoice vt <span style="color: green;">&#40;</span><span style="font-weight: bold;">lines</span> <span style="color: #339933; font-weight: bold;">$</span> <span style="font-weight: bold;">show</span> <span style="color: #339933; font-weight: bold;">_</span>converted<span style="color: #339933; font-weight: bold;">_</span>opts<span style="color: green;">&#41;</span> <span style="color: red;">0</span> sx sy</pre></div></div>


<p>That&#8217;s it.  The first step, albeit a small one.</p>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='linkbuttons'><a href='http://digg.com/submit?phase=2&amp;url=http://therning.org/magnus/archives/685&amp;title=Making a choice from a list in Haskell, Vty (part 1)' title='Digg It!' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/digg.png' style='width:16px; height:16px;' alt='[Digg] ' /></a> <a href='http://reddit.com/submit?url=http://therning.org/magnus/archives/685&amp;title=Making a choice from a list in Haskell, Vty (part 1)' title='Reddit' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/reddit.png' style='width:16px; height:16px;' alt='[Reddit] ' /></a>  <a title='See more bookmark and sharing options...' href='http://therning.org/magnus/archives/685#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div></div>]]></content:encoded>
			<wfw:commentRss>http://therning.org/magnus/archives/685/feed</wfw:commentRss>
		</item>
		<item>
		<title>Setting up Epiphany to play with Seed extensions</title>
		<link>http://therning.org/magnus/archives/674</link>
		<comments>http://therning.org/magnus/archives/674#comments</comments>
		<pubDate>Fri, 03 Jul 2009 08:22:05 +0000</pubDate>
		<dc:creator>Magnus</dc:creator>
		
		<category><![CDATA[Posts]]></category>

		<category><![CDATA[epiphany]]></category>

		<category><![CDATA[gnome]]></category>

		<category><![CDATA[seed]]></category>

		<guid isPermaLink="false">http://therning.org/magnus/?p=674</guid>
		<description><![CDATA[Since the Python extensions to Epiphany have been removed from the repository I thought it was high time to start playing with what seems to be the replacement to Python extensions: Seed extensions.  The first step is of course to get a version of Epiphany that supports Seed extensions.  After a few emails [...]]]></description>
			<content:encoded><![CDATA[<p>Since the Python extensions to Epiphany have been removed from the repository I thought it was high time to start playing with what seems to be the replacement to Python extensions: <a href="http://live.gnome.org/Seed/">Seed</a> extensions.  The first step is of course to get a version of Epiphany that supports Seed extensions.  After a few emails on the mailing list I&#8217;ve come to a recipe (I&#8217;ve done this twice now on different machines to I&#8217;m fairly confident it works).  I should probably preface this by saying that I run an up-to-date <a href="http://www.archlinux.org/">Arch</a> system, if you run something else you might need to do a bit more, or less if you&#8217;re lucky <img src='http://therning.org/magnus/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>

<ol>
<li>Make sure the following packages are installed<sup>i</sup>: <code>libsoup</code>, <code>libwebkit</code>, <code>gnome-common</code>, <code>intltool</code>, <code>libffi</code></li>
<li>Clone the following Git repositories from <a href="http://git.gnome.org/">git.gnome.org</a>: <code>epiphany-extensions</code>, <code>epiphany</code>, <code>seed</code>, <code>gobject-inspection</code>, <code>gnome-js-common</code>, <code>gir-repository</code></li>
<li><p>Decide on a <code>$prefix</code>, i.e. where you want it all installed (I use <code>~/opt/gnome-trunk</code>).  Then export the following environment variables:</p>

<pre><code>export PATH=$prefix/bin:$PATH
export PKG_CONFIG_PATH=$prefix/lib/pkgconfig
</code></pre></li>
<li><p>Then configure, build and install everything.  Use the <code>autogen.sh</code> script to create the configuration, and make sure to pass it <code>prefix=$prefix</code> each time.  Some of the modules need extra arguments as well.  This is the order and extra arguments I used:</p>

<ol>
<li><code>gnome-js-common</code> (<code>--disable-seed --disable-gjs</code>)</li>
<li><code>seed</code></li>
<li><code>gnome-js-common</code> (<code>--disable-gjs</code>)</li>
<li><code>gobject-introspection</code></li>
<li><code>gir-repository</code></li>
<li><code>epiphany</code> (<code>--enable-introspection --enable-seed</code>)</li>
<li><code>epiphany-extensions</code></li>
</ol></li>
</ol>

<p>After that you can put your extensions in <code>~/.gnome2/epiphany/extensions/</code>.  I have two instances of Epiphany installed, a stable from my distro, and the dev version I built myself.  I haven&#8217;t managed to run them both side by side, but beyond that there seems to be no bad interaction between them.</p>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='linkbuttons'><a href='http://digg.com/submit?phase=2&amp;url=http://therning.org/magnus/archives/674&amp;title=Setting up Epiphany to play with Seed extensions' title='Digg It!' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/digg.png' style='width:16px; height:16px;' alt='[Digg] ' /></a> <a href='http://reddit.com/submit?url=http://therning.org/magnus/archives/674&amp;title=Setting up Epiphany to play with Seed extensions' title='Reddit' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/reddit.png' style='width:16px; height:16px;' alt='[Reddit] ' /></a>  <a title='See more bookmark and sharing options...' href='http://therning.org/magnus/archives/674#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div></div><ol class="footnotes"><li id="footnote_0_674" class="footnote">You might need a few more packages depending on what desktop environment you use.  Those were the packages I needed to add to my machine where I run Gnome and do regular non-Gnome development</li></ol>]]></content:encoded>
			<wfw:commentRss>http://therning.org/magnus/archives/674/feed</wfw:commentRss>
		</item>
		<item>
		<title>Dataenc finally making it into Debian</title>
		<link>http://therning.org/magnus/archives/672</link>
		<comments>http://therning.org/magnus/archives/672#comments</comments>
		<pubDate>Wed, 01 Jul 2009 13:54:59 +0000</pubDate>
		<dc:creator>Magnus</dc:creator>
		
		<category><![CDATA[Posts]]></category>

		<category><![CDATA[dataenc]]></category>

		<category><![CDATA[haskell]]></category>

		<guid isPermaLink="false">http://therning.org/magnus/?p=672</guid>
		<description><![CDATA[Erik de Castro Lopo is having a lot more success with getting dataenc into Debian than I ever had.
   More&#160;&#187;]]></description>
			<content:encoded><![CDATA[<p>Erik de Castro Lopo is having a lot more success with getting <a href="http://www.mega-nerd.com/erikd/Blog/CodeHacking/Debian/polyparse_dataenc_json.html">dataenc into Debian</a> than I ever had.</p>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='linkbuttons'><a href='http://digg.com/submit?phase=2&amp;url=http://therning.org/magnus/archives/672&amp;title=Dataenc finally making it into Debian' title='Digg It!' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/digg.png' style='width:16px; height:16px;' alt='[Digg] ' /></a> <a href='http://reddit.com/submit?url=http://therning.org/magnus/archives/672&amp;title=Dataenc finally making it into Debian' title='Reddit' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/reddit.png' style='width:16px; height:16px;' alt='[Reddit] ' /></a>  <a title='See more bookmark and sharing options...' href='http://therning.org/magnus/archives/672#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div></div>]]></content:encoded>
			<wfw:commentRss>http://therning.org/magnus/archives/672/feed</wfw:commentRss>
		</item>
		<item>
		<title>Making a choice from a list in Haskell, Vty (part 0)</title>
		<link>http://therning.org/magnus/archives/664</link>
		<comments>http://therning.org/magnus/archives/664#comments</comments>
		<pubDate>Sun, 28 Jun 2009 21:17:50 +0000</pubDate>
		<dc:creator>Magnus</dc:creator>
		
		<category><![CDATA[Posts]]></category>

		<category><![CDATA[haskell]]></category>

		<category><![CDATA[vty]]></category>

		<guid isPermaLink="false">http://therning.org/magnus/?p=664</guid>
		<description><![CDATA[I haven&#8217;t had much free time lately, which means I haven&#8217;t written much
non-work code.  The only exception is some experiments with a small piece of
Haskell code using the Vty module.  Many moons ago I wrote a small piece
of code that let&#8217;s the user choose options from a list in a terminal.
Somewhat similar to [...]]]></description>
			<content:encoded><![CDATA[<p>I haven&#8217;t had much free time lately, which means I haven&#8217;t written much
non-work code.  The only exception is some experiments with a small piece of
Haskell code using the <a href="http://hackage.haskell.org/package/vty">Vty</a> module.  Many moons ago I wrote a small piece
of code that let&#8217;s the user choose options from a list in a terminal.
Somewhat similar to what you get using <code>dialog --menu ...</code>, but of course a
lot more limited and less good looking.</p>

<p>Anyway, over the last few weeks I&#8217;ve slowly expanded it in a direction that
would be useful if I ever get around to work on yet another of those projects
that so far only exist in my head <img src='http://therning.org/magnus/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>

<p>I&#8217;ve kept the transformations in a stack of patches using <a href="http://savannah.nongnu.org/projects/quilt">quilt</a>, and I
thought I&#8217;d write a little about them.  Not because I think they are extremely useful or even
good in any way, but more because I really need to get back to writing some
blog posts <img src='http://therning.org/magnus/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>

<p>This is the zeroth post containing the version I put together when I first
came across <code>Vty</code>.  It is an executable program so it starts with the familiar</p>


<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></pre></div></div>


<p>Next comes a few modules that have to be imported:</p>


<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;"><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> Graphics<span style="color: #339933; font-weight: bold;">.</span>Vty
<span style="color: #06c; font-weight: bold;">import</span> <span style="color: #06c; font-weight: bold;">qualified</span> Data<span style="color: #339933; font-weight: bold;">.</span>ByteString<span style="color: #339933; font-weight: bold;">.</span>Char8 <span style="color: #06c; font-weight: bold;">as</span> B</pre></div></div>


<p>The options are, in this version, represented as a list of strings.  For now
it&#8217;s enough to have a nonsensical list of unique strings.</p>


<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;">options <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#91;</span> <span style="color: green;">&#40;</span><span style="font-weight: bold;">show</span> i<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">++</span> <span style="background-color: #3cb371;">&quot; Foo&quot;</span> <span style="color: #339933; font-weight: bold;">|</span> i <span style="color: #339933; font-weight: bold;">&lt;-</span> <span style="color: green;">&#91;</span>0<span style="color: #339933; font-weight: bold;">..</span>59<span style="color: green;">&#93;</span><span style="color: green;">&#93;</span></pre></div></div>


<p>The <code>main</code> function is as small as possible, two rows, the first creating an
instance of <code>Vty</code> and the second getting the choice and feeding it into
<code>print</code>.</p>


<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;">main <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #06c; font-weight: bold;">do</span>
    vt <span style="color: #339933; font-weight: bold;">&lt;-</span> mkVty
    getChoice vt options <span style="color: #339933; font-weight: bold;">&gt;&gt;=</span> <span style="font-weight: bold;">print</span></pre></div></div>


<p>Of course one would think that <code>geChoice</code> would be the meat of the code, but
it is also short.  After getting the size of the terminal it calls
<code>_getChoice</code>, which <em>is</em> the meat of the code.  The reason for this split is
the handling of resize events.</p>


<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;">getChoice vt opts <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #06c; font-weight: bold;">do</span>
    <span style="color: green;">&#40;</span>sx<span style="color: #339933; font-weight: bold;">,</span> sy<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">&lt;-</span> getSize vt
    <span style="color: #339933; font-weight: bold;">_</span>getChoice vt opts <span style="color: red;">0</span> sx sy</pre></div></div>


<p>The main part of <code>_getChoice</code> is straight forward, first update the terminal,
then wait for an event, and finally handle the event.  Unless the user wants
to exit (pressing enter choses an item, pressing escape exits without a
choice) a recursive call is made to <code>_getChoice</code> with slightly modified
arguments.</p>

<p>Probably the most complicated part is the calculation of the top of the list
of visible items.  The idea is that if the list has more items than there are
lines in the terminal then the <em>cursor</em> moves down until the middle line, once
there any down movement will result in the list scrolling up.  This continues
until the end of the list is visible, at that point the <em>cursor</em> moves down
towards the last line in the terminal.  I doubt that explanation makes sense,
hopefully it&#8217;ll be clear to anyone who bothers running the code.</p>


<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;"><span style="color: #339933; font-weight: bold;">_</span>getChoice vt opts idx sx sy <span style="color: #339933; font-weight: bold;">=</span>
    <span style="color: #06c; font-weight: bold;">let</span>
        <span style="color: #339933; font-weight: bold;">_</span>calcTop winHeight listLength idx <span style="color: #339933; font-weight: bold;">=</span> <span style="font-weight: bold;">max</span> 0 <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span><span style="font-weight: bold;">min</span> listLength <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span><span style="font-weight: bold;">max</span> 0 <span style="color: green;">&#40;</span>idx <span style="color: #339933; font-weight: bold;">-</span> winHeight `<span style="font-weight: bold;">div</span>` 2<span style="color: green;">&#41;</span><span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">+</span> winHeight<span style="color: green;">&#41;</span><span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">-</span> winHeight<span style="color: green;">&#41;</span>
        <span style="color: #339933; font-weight: bold;">_</span>top <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #339933; font-weight: bold;">_</span>calcTop sy <span style="color: green;">&#40;</span><span style="font-weight: bold;">length</span> opts<span style="color: green;">&#41;</span> idx
        <span style="color: #339933; font-weight: bold;">_</span>visible<span style="color: #339933; font-weight: bold;">_</span>opts <span style="color: #339933; font-weight: bold;">=</span> <span style="font-weight: bold;">take</span> sy <span style="color: green;">&#40;</span><span style="font-weight: bold;">drop</span> <span style="color: #339933; font-weight: bold;">_</span>top opts<span style="color: green;">&#41;</span>
    <span style="color: #06c; font-weight: bold;">in</span> <span style="color: #06c; font-weight: bold;">do</span>
        update vt <span style="color: green;">&#40;</span>render <span style="color: #339933; font-weight: bold;">_</span>visible<span style="color: #339933; font-weight: bold;">_</span>opts <span style="color: green;">&#40;</span>idx <span style="color: #339933; font-weight: bold;">-</span> <span style="color: #339933; font-weight: bold;">_</span>top<span style="color: green;">&#41;</span> sx<span style="color: green;">&#41;</span>
        k <span style="color: #339933; font-weight: bold;">&lt;-</span> getEvent vt
        <span style="color: #06c; font-weight: bold;">case</span> k <span style="color: #06c; font-weight: bold;">of</span>
            EvKey KDown <span style="color: green;">&#91;</span><span style="color: green;">&#93;</span> <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="color: #339933; font-weight: bold;">_</span>getChoice vt opts <span style="color: green;">&#40;</span><span style="font-weight: bold;">min</span> <span style="color: green;">&#40;</span><span style="font-weight: bold;">length</span> opts <span style="color: #339933; font-weight: bold;">-</span> 1<span style="color: green;">&#41;</span> <span style="color: green;">&#40;</span>idx <span style="color: #339933; font-weight: bold;">+</span> 1<span style="color: green;">&#41;</span><span style="color: green;">&#41;</span> sx sy
            EvKey KUp <span style="color: green;">&#91;</span><span style="color: green;">&#93;</span> <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="color: #339933; font-weight: bold;">_</span>getChoice vt opts <span style="color: green;">&#40;</span><span style="font-weight: bold;">max</span> 0 <span style="color: green;">&#40;</span>idx <span style="color: #339933; font-weight: bold;">-</span> 1<span style="color: green;">&#41;</span><span style="color: green;">&#41;</span> sx sy
            EvKey KEsc <span style="color: green;">&#91;</span><span style="color: green;">&#93;</span> <span style="color: #339933; font-weight: bold;">-&gt;</span> shutdown vt <span style="color: #339933; font-weight: bold;">&gt;&gt;</span> <span style="font-weight: bold;">return</span> Nothing
            EvKey KEnter <span style="color: green;">&#91;</span><span style="color: green;">&#93;</span> <span style="color: #339933; font-weight: bold;">-&gt;</span> shutdown vt <span style="color: #339933; font-weight: bold;">&gt;&gt;</span> <span style="font-weight: bold;">return</span> <span style="color: green;">&#40;</span>Just <span style="color: #339933; font-weight: bold;">$</span> <span style="color: green;">&#40;</span>idx<span style="color: #339933; font-weight: bold;">,</span> opts <span style="color: #339933; font-weight: bold;">!!</span> idx<span style="color: green;">&#41;</span><span style="color: green;">&#41;</span>
            EvResize nx ny <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="color: #339933; font-weight: bold;">_</span>getChoice vt opts idx nx ny
            <span style="color: #339933; font-weight: bold;">_</span> <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="color: #339933; font-weight: bold;">_</span>getChoice vt opts idx sx sy</pre></div></div>


<p>The final piece is the code that renders the list.  The items of the list are
zipped together with a list of integers.  Each such tuple is then rendered
into a line((The reason for the line rendering looking so complicated is that
<code>Vty</code> requires each line to be of equal lenght.)), where the line of the
cursor is highlighted.  The resulting list of rendered lines is then folded into
a full image.</p>


<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;">render opts idx sx <span style="color: #339933; font-weight: bold;">=</span> pic <span style="color: green;">&#123;</span>
    pImage <span style="color: #339933; font-weight: bold;">=</span> <span style="font-weight: bold;">foldr1</span> <span style="color: green;">&#40;</span><span style="color: #339933; font-weight: bold;">&lt;-&gt;</span><span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">$</span> <span style="font-weight: bold;">map</span> <span style="color: #339933; font-weight: bold;">_</span>render1 <span style="color: #339933; font-weight: bold;">$</span> <span style="font-weight: bold;">zip</span> <span style="color: green;">&#91;</span>0<span style="color: #339933; font-weight: bold;">..</span><span style="color: green;">&#93;</span> opts
    <span style="color: green;">&#125;</span>
    <span style="color: #06c; font-weight: bold;">where</span>
        <span style="color: #339933; font-weight: bold;">_</span>render1 <span style="color: green;">&#40;</span>i<span style="color: #339933; font-weight: bold;">,</span> o<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">=</span> renderHFill attr ' ' 5 <span style="color: #339933; font-weight: bold;">&lt;|&gt;</span> renderBS <span style="color: green;">&#40;</span><span style="color: #339933; font-weight: bold;">_</span>attr i<span style="color: green;">&#41;</span> <span style="color: green;">&#40;</span>B<span style="color: #339933; font-weight: bold;">.</span>pack o<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">&lt;|&gt;</span> renderHFill attr ' ' <span style="color: green;">&#40;</span>sx <span style="color: #339933; font-weight: bold;">-</span> 5 <span style="color: #339933; font-weight: bold;">-</span> <span style="font-weight: bold;">length</span> o<span style="color: green;">&#41;</span>
        <span style="color: #339933; font-weight: bold;">_</span>attr i <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #06c; font-weight: bold;">if</span> i <span style="color: #339933; font-weight: bold;">/=</span> idx
            <span style="color: #06c; font-weight: bold;">then</span> attr
            <span style="color: #06c; font-weight: bold;">else</span> setRV attr</pre></div></div>


<p>That&#8217;s it, that&#8217;s the starting point.  It&#8217;s also likely to be the longest post
in this planned series. <img src='http://therning.org/magnus/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='linkbuttons'><a href='http://digg.com/submit?phase=2&amp;url=http://therning.org/magnus/archives/664&amp;title=Making a choice from a list in Haskell, Vty (part 0)' title='Digg It!' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/digg.png' style='width:16px; height:16px;' alt='[Digg] ' /></a> <a href='http://reddit.com/submit?url=http://therning.org/magnus/archives/664&amp;title=Making a choice from a list in Haskell, Vty (part 0)' title='Reddit' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/reddit.png' style='width:16px; height:16px;' alt='[Reddit] ' /></a>  <a title='See more bookmark and sharing options...' href='http://therning.org/magnus/archives/664#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div></div>]]></content:encoded>
			<wfw:commentRss>http://therning.org/magnus/archives/664/feed</wfw:commentRss>
		</item>
		<item>
		<title>Using msmtp with darcs</title>
		<link>http://therning.org/magnus/archives/656</link>
		<comments>http://therning.org/magnus/archives/656#comments</comments>
		<pubDate>Tue, 09 Jun 2009 16:50:59 +0000</pubDate>
		<dc:creator>Magnus</dc:creator>
		
		<category><![CDATA[Posts]]></category>

		<category><![CDATA[darcs]]></category>

		<category><![CDATA[msmtp]]></category>

		<guid isPermaLink="false">http://therning.org/magnus/?p=656</guid>
		<description><![CDATA[To get darcs to use msmtp I put the following in my ~/.darcs/defaults:


send sendmail-command /usr/bin/msmtp %t %&#60;

   More&#160;&#187;]]></description>
			<content:encoded><![CDATA[<p>To get <a href="http://www.darcs.net/">darcs</a> to use <code>msmtp</code> I put the following in my <code>~/.darcs/defaults</code>:</p>


<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">send sendmail-command /usr/bin/msmtp %t %&lt;</pre></div></div>

<div class='bookmarkify'><a name='bookmarkify'></a><div class='linkbuttons'><a href='http://digg.com/submit?phase=2&amp;url=http://therning.org/magnus/archives/656&amp;title=Using msmtp with darcs' title='Digg It!' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/digg.png' style='width:16px; height:16px;' alt='[Digg] ' /></a> <a href='http://reddit.com/submit?url=http://therning.org/magnus/archives/656&amp;title=Using msmtp with darcs' title='Reddit' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/reddit.png' style='width:16px; height:16px;' alt='[Reddit] ' /></a>  <a title='See more bookmark and sharing options...' href='http://therning.org/magnus/archives/656#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div></div>]]></content:encoded>
			<wfw:commentRss>http://therning.org/magnus/archives/656/feed</wfw:commentRss>
		</item>
		<item>
		<title>Using msmtp with Mercurial</title>
		<link>http://therning.org/magnus/archives/651</link>
		<comments>http://therning.org/magnus/archives/651#comments</comments>
		<pubDate>Tue, 09 Jun 2009 11:05:14 +0000</pubDate>
		<dc:creator>Magnus</dc:creator>
		
		<category><![CDATA[Posts]]></category>

		<category><![CDATA[hg]]></category>

		<category><![CDATA[mercurial]]></category>

		<category><![CDATA[msmtp]]></category>

		<guid isPermaLink="false">http://therning.org/magnus/?p=651</guid>
		<description><![CDATA[After configuring msmtp I put the following in my ~/.hgrc:


&#91;extensions&#93;
hgext.patchbomb =
&#160;
&#91;email&#93;
from = my.email@my.isp.com
method = /usr/bin/msmtp

   More&#160;&#187;]]></description>
			<content:encoded><![CDATA[<p>After configuring <code>msmtp</code> I put the following in my <code>~/.hgrc</code>:</p>


<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;"><span style="color: #000066; font-weight:bold;"><span style="">&#91;</span>extensions<span style="">&#93;</span></span>
hgext.patchbomb <span style="color: #000066; font-weight:bold;">=</span>
&nbsp;
<span style="color: #000066; font-weight:bold;"><span style="">&#91;</span>email<span style="">&#93;</span></span>
<span style="color: #000099;">from</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> my.email@my.isp.com</span>
<span style="color: #000099;">method</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> /usr/bin/msmtp</span></pre></div></div>

<div class='bookmarkify'><a name='bookmarkify'></a><div class='linkbuttons'><a href='http://digg.com/submit?phase=2&amp;url=http://therning.org/magnus/archives/651&amp;title=Using msmtp with Mercurial' title='Digg It!' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/digg.png' style='width:16px; height:16px;' alt='[Digg] ' /></a> <a href='http://reddit.com/submit?url=http://therning.org/magnus/archives/651&amp;title=Using msmtp with Mercurial' title='Reddit' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/reddit.png' style='width:16px; height:16px;' alt='[Reddit] ' /></a>  <a title='See more bookmark and sharing options...' href='http://therning.org/magnus/archives/651#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div></div>]]></content:encoded>
			<wfw:commentRss>http://therning.org/magnus/archives/651/feed</wfw:commentRss>
		</item>
		<item>
		<title>Using msmtp for a desktop system</title>
		<link>http://therning.org/magnus/archives/647</link>
		<comments>http://therning.org/magnus/archives/647#comments</comments>
		<pubDate>Fri, 05 Jun 2009 22:44:22 +0000</pubDate>
		<dc:creator>Magnus</dc:creator>
		
		<category><![CDATA[Posts]]></category>

		<category><![CDATA[arch]]></category>

		<category><![CDATA[email]]></category>

		<category><![CDATA[fcron]]></category>

		<category><![CDATA[msmtp]]></category>

		<guid isPermaLink="false">http://therning.org/magnus/?p=647</guid>
		<description><![CDATA[I read all my email via IMAP, and send all email via external SMTP servers, but at times it&#8217;s really useful to be able to run something like /usr/sbin/sendmail to send an email.  Many tools depend on it, for me I want reports on cron jobs and I like using darcs send straight to [...]]]></description>
			<content:encoded><![CDATA[<p>I read all my email via IMAP, and send all email via external SMTP servers, but at times it&#8217;s really useful to be able to run something like <code>/usr/sbin/sendmail</code> to send an email.  Many tools depend on it, for me I want reports on <code>cron</code> jobs and I like using <code>darcs send</code> straight to an email address.  For this a full-fledged SMTP server like exim/postfix/sendmail clearly is overkill.  First I had a quick look at <a href="http://www.archlinux.org/packages/extra/x86_64/ssmtp/">ssmtp</a> but it only allows for a system-wide configuration file.  Ideally I&#8217;d like &#8220;system-mails&#8221; (like <code>cron</code>) to be sent via my ISP while more personal emails should be sent via my Google account.  After a suggestion on the Arch mailing list I checked out <a href="http://www.archlinux.org/packages/extra/x86_64/msmtp/">msmtp</a> and it was exactly what I was looking for.</p>

<p>I created <code>/etc/msmtprc</code> with the following contents:</p>


<div class="wp_syntax"><div class="code"><pre class="foo" style="font-family:monospace;">defaults
logfile ~/.msmtp.log
&nbsp;
# MyISP
account myisp
host smtp.myisp.com
from my.email@myisp.com
&nbsp;
account default : myisp</pre></div></div>


<p>I then found out that [dcron][3] is severely limited; it doesn&#8217;t honour <code>MAILTO</code> in <code>crontabs</code> and it&#8217;s not possibly to use anything but <code>/usr/sbin/sendmail</code> to send emails.  The lack of support for <code>MAILTO</code> is the deal breaker in this case.</p>

<p>Rather than create a symbolic link I modified <code>fcron</code>&#8217;s configuration file, <code>/etc/fcron/fcron.conf</code>, to use <code>/usr/bin/msmtp</code>:</p>


<div class="wp_syntax"><div class="code"><pre class="foo" style="font-family:monospace;">sendmail = /usr/bin/msmtp</pre></div></div>


<p>I also made sure to stick <code>MAILTO=my.email@myisp.com</code> in the system <code>crontab</code>, using <code>fcrontab -u systab -e</code>.</p>

<p>Then I created the file <code>~/.msmtprc</code>:</p>


<div class="wp_syntax"><div class="code"><pre class="foo" style="font-family:monospace;">defaults
logfile ~/.msmtp.log
&nbsp;
# MyISP
account mysisp
host smtp.myisp.com
from my.email@myisp.com
&nbsp;
# google
account google
host smtp.gmail.com
from user@googlemail.com
tls on
tls_certcheck off
auth on
user user@googlemail.com
password MySecretPassword
&nbsp;
account default : google</pre></div></div>


<p>Finally I put <code>MAILTO=user@googlemail.com</code> in my user&#8217;s <code>crontab</code>.</p>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='linkbuttons'><a href='http://digg.com/submit?phase=2&amp;url=http://therning.org/magnus/archives/647&amp;title=Using msmtp for a desktop system' title='Digg It!' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/digg.png' style='width:16px; height:16px;' alt='[Digg] ' /></a> <a href='http://reddit.com/submit?url=http://therning.org/magnus/archives/647&amp;title=Using msmtp for a desktop system' title='Reddit' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/reddit.png' style='width:16px; height:16px;' alt='[Reddit] ' /></a>  <a title='See more bookmark and sharing options...' href='http://therning.org/magnus/archives/647#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div></div>]]></content:encoded>
			<wfw:commentRss>http://therning.org/magnus/archives/647/feed</wfw:commentRss>
		</item>
		<item>
		<title>Reply to Randal on dynamic type systems</title>
		<link>http://therning.org/magnus/archives/629</link>
		<comments>http://therning.org/magnus/archives/629#comments</comments>
		<pubDate>Thu, 14 May 2009 09:27:00 +0000</pubDate>
		<dc:creator>Magnus</dc:creator>
		
		<category><![CDATA[Posts]]></category>

		<category><![CDATA[dynamic languages]]></category>

		<category><![CDATA[floss weekly]]></category>

		<category><![CDATA[haskell]]></category>

		<category><![CDATA[randal schwartz]]></category>

		<guid isPermaLink="false">http://therning.org/magnus/?p=629</guid>
		<description><![CDATA[At first this I wrote this as a comment on my original post, but it grew a bit too long so I decided to post it like this instead.

@Randal, &#8220;Static typing is still effectively a syntax check, not a semantic check though.&#8221;  Now, I think we might have a different understanding of the word [...]]]></description>
			<content:encoded><![CDATA[<p>At first this I wrote this as a comment on my <a href="http://therning.org/magnus/archives/620">original post</a>, but it grew a bit too long so I decided to post it like this instead.</p>

<p><strong>@Randal</strong>, &#8220;Static typing is still effectively a syntax check, not a semantic check though.&#8221;  Now, I think we might have a different understanding of the word &#8220;syntax&#8221;.  I can guess at yours, but my understanding mirrors what&#8217;s on <a href="http://foldoc.org/syntax">Foldoc</a>, that is syntax determines what is a valid string in a program, in this case it determines <em>where</em> a type declaration/definition/statement goes, but not <em>what</em> type declaration/definition/statement is <em>semantically</em> valid in a particular position in a string.  That &#8220;<em>what</em>&#8221; is very much part of the semantics in my mind, it tells the world (me, other users of my library, the compiler) a part of the intention of a function, it tells how something may be used.  I gather you are mostly familiar with type systems like Java so what is clearer to you, this declaration:</p>


<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">int</span> add<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i, <span style="color: #000066; font-weight: bold;">int</span> j<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>


<p>or this declaration:</p>


<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">int</span> add<span style="color: #009900;">&#40;</span>i, j<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>


<p>In the former the intent of the function is obvious, it adds integers.  In the latter it isn&#8217;t, does it handle complex numbers?  Does it handle matrices?  In dynamic languages you&#8217;d have to document it somewhere, but there is no consistency check between code and documentation (maybe there are external tools for that though, but why not use the compiler to check?).  You would also have to test that no caller of this function can be tricked into calling <code>add</code> with a non-integer.</p>

<p>Also, though your example of &#8220;semantic type checking&#8221; in the talk is interesting (I simply don&#8217;t know if there are any type systems that could deal with it) you completely skip all the cases where the type system <em>can</em> do the job and where it <em>does</em> save on testing and typing.  In these cases you would have a <em>proof</em> relating to your use of types in the program, unit testing can <em>never</em> give that proof it can only show you haven&#8217;t disproved it yet <img src='http://therning.org/magnus/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>

<p>If you remain unconvinced then I strongly urge you to read <a href="http://blog.moertel.com/articles/2006/10/18/a-type-based-solution-to-the-strings-problem">Tom Moertel&#8217;s post on providing safe strings</a>, and the assurance you can achieve by using a strong type system in relation to information flow through your program.  The same technique has been used in Darcs (watch the <a href="http://www.londonhug.net/2008/02/02/video-darcs-and-gadts/">video</a>, the bit relevant for this dicussion starts about 43 minutes in).</p>

<p>I urge you to read Kristian&#8217;s blog post (linked to in his <a href="http://therning.org/magnus/archives/620#comment-178794">comment</a>).</p>

<p>If you want a podcast to listen to there&#8217;s <a href="http://www.se-radio.net/podcast/2007-07/episode-62-martin-odersky-scala">episode 62 of Software Engineering Radio</a> where Martin Odersky talks about Scala (a statically typed language built on the JVM).</p>

<p>I&#8217;d also like to clear one thing up, I don&#8217;t dislike dynamic languages and I don&#8217;t think that static languages are inherently better.  What I do dislike about your talk is that it&#8217;s uninformed, presents very narrow arguments and then draws conclusions that are very general and simply don&#8217;t follow from the given arguments.</p>

<p>Finally, I <em>really</em> enjoy <a href="http://twit.tv/FLOSS">FLOSS Weekly</a>.  You and Leo are doing a fantastic job on it, but since it is where I first heard of your talk (I suspect <a href="http://www.cincomsmalltalk.com/blog/blogView?searchCategory=podcast">Industry Misinterpretations</a> might not get a lot of attention outside the Smalltalk community) I really think you should talk to someone from the FLOSS FP community.  Get someone who can explain, much better than me, what a modern, advanced, strong, statically typed language will get you.  I only have experience with OCaml and Haskell, and there are others, like Scala, all are FLOSS and hopefully it wouldn&#8217;t be too much work to find someone knowledgable who&#8217;d be willing to set you straight on the dynamic vs static typing issue.  I&#8217;d be happy to do what I can to help you find someone, just let me know if you are insterested <img src='http://therning.org/magnus/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='linkbuttons'><a href='http://digg.com/submit?phase=2&amp;url=http://therning.org/magnus/archives/629&amp;title=Reply to Randal on dynamic type systems' title='Digg It!' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/digg.png' style='width:16px; height:16px;' alt='[Digg] ' /></a> <a href='http://reddit.com/submit?url=http://therning.org/magnus/archives/629&amp;title=Reply to Randal on dynamic type systems' title='Reddit' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/reddit.png' style='width:16px; height:16px;' alt='[Reddit] ' /></a>  <a title='See more bookmark and sharing options...' href='http://therning.org/magnus/archives/629#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div></div>]]></content:encoded>
			<wfw:commentRss>http://therning.org/magnus/archives/629/feed</wfw:commentRss>
		</item>
		<item>
		<title>Struggling with &#8220;the Arch way&#8221;</title>
		<link>http://therning.org/magnus/archives/626</link>
		<comments>http://therning.org/magnus/archives/626#comments</comments>
		<pubDate>Wed, 13 May 2009 20:54:20 +0000</pubDate>
		<dc:creator>Magnus</dc:creator>
		
		<category><![CDATA[Posts]]></category>

		<category><![CDATA[arch]]></category>

		<category><![CDATA[aur]]></category>

		<category><![CDATA[getlatestvimscripts]]></category>

		<category><![CDATA[haskell]]></category>

		<category><![CDATA[haskellmode]]></category>

		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://therning.org/magnus/?p=626</guid>
		<description><![CDATA[So, I&#8217;m struggling somewhat with the move to Arch.  Not that Arch is
problematic in any way, it seems to be me and my &#8220;debianised thinking&#8221;.

I noticed that the Vim plugins that were packaged for Arch all install in
system directories and hence are imposed on all users.  Not a good thing.  So,
inspired by [...]]]></description>
			<content:encoded><![CDATA[<p>So, I&#8217;m struggling somewhat with the move to Arch.  Not that Arch is
problematic in any way, it seems to be me and my &#8220;debianised thinking&#8221;.</p>

<p>I noticed that the Vim plugins that were packaged for Arch all install in
system directories and hence are imposed on all users.  Not a good thing.  So,
inspired by Debian&#8217;s <a href="http://packages.debian.org/search?keywords=vim-addon-manager">vim-addons-manager</a>, I hacked up a solution relying
on pacman.  Then I packaged two Vim plugins for Arch.  The idea was to do
rather than talk, so it wasn&#8217;t until after this that I asked for feedback on
<a href="http://www.archlinux.org/pipermail/aur-general/2009-May/004861.html">aur-general</a>.  Just to have the idea shot down <img src='http://therning.org/magnus/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>

<p>Anyway, after being presented with an existing solution more inline with &#8220;the
Arch way&#8221; I decided to try it out.  I&#8217;ve now subscribed to using
<a href="http://www.vim.org/scripts/script.php?script_id=642">GetLatestVimScripts</a>.  Brilliant.</p>

<p>Now I need to convince the author of <code>haskellmode</code> to put it on <a href="http://www.vim.org/">vim.org</a>
and I really ought to get my packages off AUR.</p>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='linkbuttons'><a href='http://digg.com/submit?phase=2&amp;url=http://therning.org/magnus/archives/626&amp;title=Struggling with &#8220;the Arch way&#8221;' title='Digg It!' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/digg.png' style='width:16px; height:16px;' alt='[Digg] ' /></a> <a href='http://reddit.com/submit?url=http://therning.org/magnus/archives/626&amp;title=Struggling with &#8220;the Arch way&#8221;' title='Reddit' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/reddit.png' style='width:16px; height:16px;' alt='[Reddit] ' /></a>  <a title='See more bookmark and sharing options...' href='http://therning.org/magnus/archives/626#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div></div>]]></content:encoded>
			<wfw:commentRss>http://therning.org/magnus/archives/626/feed</wfw:commentRss>
		</item>
		<item>
		<title>Randal Schwartz on why dynamic beat static&#8212;a rather rubbish talk</title>
		<link>http://therning.org/magnus/archives/620</link>
		<comments>http://therning.org/magnus/archives/620#comments</comments>
		<pubDate>Wed, 13 May 2009 20:22:53 +0000</pubDate>
		<dc:creator>Magnus</dc:creator>
		
		<category><![CDATA[Posts]]></category>

		<category><![CDATA[don stewart]]></category>

		<category><![CDATA[floss weekly]]></category>

		<category><![CDATA[haskell]]></category>

		<category><![CDATA[randal schwartz]]></category>

		<guid isPermaLink="false">http://therning.org/magnus/?p=620</guid>
		<description><![CDATA[Well, not the most diplomatic title maybe, but listening to Randal Schwartz&#8217; talk &#8220;Dynamic Returns&#8221; first made me laugh and then made my fingers itch to write him an email addressing the fallacies he is peddling.  Anyway, I wrote this large, rather ranting, blog post but then decided to not publish iti.

Randal, my suggestion [...]]]></description>
			<content:encoded><![CDATA[<p>Well, not the most diplomatic title maybe, but listening to <a href="http://www.cincomsmalltalk.com/blog/SingleView.ssp?showComments=true&amp;entry=3419405760">Randal Schwartz&#8217; talk &#8220;Dynamic Returns&#8221;</a> first made me laugh and then made my fingers itch to write him an email addressing the fallacies he is peddling.  Anyway, I wrote this large, rather ranting, blog post but then decided to not publish it<sup>i</sup>.</p>

<p>Randal, my suggestion to you is that you get someone like Don Stewart on FLOSS Weekly (I believe he is based in Portland as well) to discuss how Haskell&#8217;s advanced type system can be harnessed to completely remove whole classes of bugs.</p>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='linkbuttons'><a href='http://digg.com/submit?phase=2&amp;url=http://therning.org/magnus/archives/620&amp;title=Randal Schwartz on why dynamic beat static&#8212;a rather rubbish talk' title='Digg It!' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/digg.png' style='width:16px; height:16px;' alt='[Digg] ' /></a> <a href='http://reddit.com/submit?url=http://therning.org/magnus/archives/620&amp;title=Randal Schwartz on why dynamic beat static&#8212;a rather rubbish talk' title='Reddit' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/reddit.png' style='width:16px; height:16px;' alt='[Reddit] ' /></a>  <a title='See more bookmark and sharing options...' href='http://therning.org/magnus/archives/620#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div></div><ol class="footnotes"><li id="footnote_0_620" class="footnote">Randal, if you read this I&#8217;ll be happy to send the draft version of the post to you, just drop me an email <img src='http://therning.org/magnus/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </li></ol>]]></content:encoded>
			<wfw:commentRss>http://therning.org/magnus/archives/620/feed</wfw:commentRss>
		</item>
	</channel>
</rss>
