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

<channel>
	<title>λ Tony’s blog λ</title>
	<atom:link href="http://blog.tmorris.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.tmorris.net</link>
	<description>The weblog of Tony Morris</description>
	<pubDate>Fri, 11 May 2012 03:12:10 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
	<language>en</language>
			<item>
		<title>SIP-18 is just another bad idea serving nobody</title>
		<link>http://blog.tmorris.net/sip-18-is-just-another-bad-idea-serving-nobody/</link>
		<comments>http://blog.tmorris.net/sip-18-is-just-another-bad-idea-serving-nobody/#comments</comments>
		<pubDate>Fri, 11 May 2012 03:12:10 +0000</pubDate>
		<dc:creator>Tony Morris</dc:creator>
		
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.tmorris.net/?p=1062</guid>
		<description><![CDATA[SIP-18 is a bad idea because it makes awful assumptions about what is in the interest of language newcomers. I have had no shortage of unsolicited advice of how to teach, most of it in layers of wrongness, so I am acutely aware of the sheer quantity of this kind of advice. Please refrain for [...]]]></description>
			<content:encoded><![CDATA[<p>SIP-18 is a bad idea because it makes awful assumptions about what is in the interest of language newcomers. I have had no shortage of unsolicited advice of how to teach, most of it in layers of wrongness, so I am acutely aware of the sheer quantity of this kind of advice. Please refrain for now. This is only my opinion, because it has been asked of me more than twice.</p>
<p>SIP-18 (and the Scala collections library for that matter) is no different to Haskell&#8217;s (dreaded) monomorphism restriction (DMR). The DMR was introduced specifically because of another chronically bold over-estimate of one&#8217;s ability to understand the process of learning. It is now an undesired language issue that hinders all users, <strong>especially newcomers</strong>. In other words, it serves nobody&#8217;s interest, hinders everyone&#8217;s interest and especially, the interest of those for whom it was meant to serve. You need only spend a short period of time with newcomers to Haskell to be overwhelmed by the prominence of this fact.</p>
<p>I can hear the pragmatists in the background muttering something about trade-offs, not being so extreme and keeping it relevant to the real world and blah blah blah, &lt;insert the usual pragmatist bullshit here&gt;. There is nothing to be traded off when you offer to take $5 from me for the low cost of $10. Now stop it and get your head out of the clouds so I can talk to you sensibly.</p>
<p>Not only does SIP-18 not help newcomers at all, it helps nobody, hinders everybody and <strong>especially newcomers</strong>. It is not a trade-off, it is not a good idea; it is simply a bold, severely misguided assertion about how learning takes place &#8212; it&#8217;s not even an approximation. I have seen only scant pseudo-psychology to support its existence, which obviates its predictable failure.</p>
<p>Hopefully, the Scala guys will work this out, but if Scala&#8217;s remarkable precision to repeat historical mistakes is anything to go by, I do not hold high hopes.</p>
<p>Thanks for asking.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tmorris.net/sip-18-is-just-another-bad-idea-serving-nobody/feed/</wfw:commentRss>
		</item>
		<item>
		<title></title>
		<link>http://blog.tmorris.net/1060/</link>
		<comments>http://blog.tmorris.net/1060/#comments</comments>
		<pubDate>Tue, 29 Nov 2011 23:36:04 +0000</pubDate>
		<dc:creator>Tony Morris</dc:creator>
		
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.tmorris.net/?p=1060</guid>
		<description><![CDATA[&#60;&#60;&#60; Insert thoughtless commentary about Scala here. Be sure not to forget that emphatic display of spectacular ignorance of the subject at hand. Click here to solicit peer support in the event that you begin to consider the possibility that you do not understand elementary topics of computer programming. Keep that hyperbole hyperbolin&#8217;! &#62;&#62;&#62;
]]></description>
			<content:encoded><![CDATA[<p>&lt;&lt;&lt; Insert thoughtless commentary about Scala here. Be sure not to forget that emphatic display of spectacular ignorance of the subject at hand. Click here to solicit peer support in the event that you begin to consider the possibility that you do not understand elementary topics of computer programming. Keep that hyperbole hyperbolin&#8217;! &gt;&gt;&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tmorris.net/1060/feed/</wfw:commentRss>
		</item>
		<item>
		<title>CAT (3D enhanced) Lumbosacral 2011-11-02 (24 hours post-op)</title>
		<link>http://blog.tmorris.net/cat-3d-enhanced-lumbosacral-2011-11-02-24-hours-post-op/</link>
		<comments>http://blog.tmorris.net/cat-3d-enhanced-lumbosacral-2011-11-02-24-hours-post-op/#comments</comments>
		<pubDate>Thu, 10 Nov 2011 23:41:04 +0000</pubDate>
		<dc:creator>Tony Morris</dc:creator>
		
		<category><![CDATA[Health]]></category>

		<guid isPermaLink="false">http://blog.tmorris.net/?p=1053</guid>
		<description><![CDATA[L4/L5/S1/Sacro-iliac fusion

L4/L5/S1 fusion performed 15 March 2011
Sacro-iliac fusion performed 01 November 2011













]]></description>
			<content:encoded><![CDATA[<h4>L4/L5/S1/Sacro-iliac fusion</h4>
<ul>
<li>L4/L5/S1 fusion performed 15 March 2011</li>
<li>Sacro-iliac fusion performed 01 November 2011</li>
</ul>
<ol>
<li><a href="http://i.imgur.com/MwVxP.png" onclick="javascript:pageTracker._trackPageview('/outbound/article/i.imgur.com');"><img src="http://i.imgur.com/MwVxP.png" alt="1" /></a></li>
<li><a href="http://i.imgur.com/TQQMK.png" onclick="javascript:pageTracker._trackPageview('/outbound/article/i.imgur.com');"><img src="http://i.imgur.com/TQQMK.png" alt="2" /></a></li>
<li><a href="http://i.imgur.com/Zx34w.png" onclick="javascript:pageTracker._trackPageview('/outbound/article/i.imgur.com');"><img src="http://i.imgur.com/Zx34w.png" alt="3" /></a></li>
<li><a href="http://i.imgur.com/Dur1v.png" onclick="javascript:pageTracker._trackPageview('/outbound/article/i.imgur.com');"><img src="http://i.imgur.com/Dur1v.png" alt="4" /></a></li>
<li><a href="http://i.imgur.com/4Q3oc.png" onclick="javascript:pageTracker._trackPageview('/outbound/article/i.imgur.com');"><img src="http://i.imgur.com/4Q3oc.png" alt="5" /></a></li>
<li><a href="http://i.imgur.com/SeAhg.png" onclick="javascript:pageTracker._trackPageview('/outbound/article/i.imgur.com');"><img src="http://i.imgur.com/SeAhg.png" alt="6" /></a></li>
<li><a href="http://i.imgur.com/4HXHd.png" onclick="javascript:pageTracker._trackPageview('/outbound/article/i.imgur.com');"><img src="http://i.imgur.com/4HXHd.png" alt="7" /></a></li>
<li><a href="http://i.imgur.com/S5AoC.png" onclick="javascript:pageTracker._trackPageview('/outbound/article/i.imgur.com');"><img src="http://i.imgur.com/S5AoC.png" alt="8" /></a></li>
<li><a href="http://i.imgur.com/Uw0KC.png" onclick="javascript:pageTracker._trackPageview('/outbound/article/i.imgur.com');"><img src="http://i.imgur.com/Uw0KC.png" alt="9" /></a></li>
<li><a href="http://i.imgur.com/BPoBt.png" onclick="javascript:pageTracker._trackPageview('/outbound/article/i.imgur.com');"><img src="http://i.imgur.com/BPoBt.png" alt="10" /></a></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://blog.tmorris.net/cat-3d-enhanced-lumbosacral-2011-11-02-24-hours-post-op/feed/</wfw:commentRss>
		</item>
		<item>
		<title>I cannot use language X</title>
		<link>http://blog.tmorris.net/i-cannot-use-language-x/</link>
		<comments>http://blog.tmorris.net/i-cannot-use-language-x/#comments</comments>
		<pubDate>Thu, 27 Oct 2011 01:27:35 +0000</pubDate>
		<dc:creator>Tony Morris</dc:creator>
		
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.tmorris.net/?p=1050</guid>
		<description><![CDATA[I often hear people complain to me that they cannot use some superior programming language in their environment. Is it the right programming language to use? You sure? Great, now toughen up and use it.
You&#8217;re being told that you cannot? What is the reason given? Because &#8220;blah blah fucking said so blah blah.&#8221; There&#8217;s your [...]]]></description>
			<content:encoded><![CDATA[<p>I often hear people complain to me that they cannot use some superior programming language in their environment. Is it the right programming language to use? You sure? Great, now toughen up and use it.</p>
<p>You&#8217;re being told that you cannot? What is the reason given? Because &#8220;blah blah fucking said so blah blah.&#8221; There&#8217;s your problem &#8212; you subscribe to the illusion of authority and attribute it to the claimant. Abandon the illusion. No; actually abandon it to the extent of total non-existence. &#8220;Yeah but blah blah blah&#8230;&#8221; &#8212; I totally didn&#8217;t hear what you just said, intentionally. The consequences are not what you think they are.</p>
<p>&#8220;Oh but how come you get to use Haskell in your job?&#8221; Because I refuse to be bullied by fools proclaiming their authority with disregard for the common goal of getting the job done. Don&#8217;t give them the leverage &#8212; by way of believing it even exists &#8212; it doesn&#8217;t. I use whatever is appropriate and Haskell is often appropriate. It&#8217;s as simple as that.</p>
<p>HTFU and just do it properly. Unicorns do not exist. Deal with it accordingly. HTH.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tmorris.net/i-cannot-use-language-x/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Data Parallelism in Haskell</title>
		<link>http://blog.tmorris.net/data-parallelism-in-haskell/</link>
		<comments>http://blog.tmorris.net/data-parallelism-in-haskell/#comments</comments>
		<pubDate>Sat, 03 Sep 2011 02:17:56 +0000</pubDate>
		<dc:creator>Tony Morris</dc:creator>
		
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.tmorris.net/?p=1046</guid>
		<description><![CDATA[Manuel M T Chakravarty &#8212; University of New South Wales
Brisbane Functional Programming Group
01 September 2011

Data Parallelism in Haskell from Rob Manthey on Vimeo.
]]></description>
			<content:encoded><![CDATA[<h3>Manuel M T Chakravarty &mdash; University of New South Wales</h3>
<h3><a href="http://bfpg.org/" onclick="javascript:pageTracker._trackPageview('/outbound/article/bfpg.org');">Brisbane Functional Programming Group</a></h3>
<p>01 September 2011</p>
<p><iframe src="http://player.vimeo.com/video/28477220?title=0&amp;byline=0&amp;portrait=0" width="400" height="300" frameborder="0"></iframe>
<p><a href="http://vimeo.com/28477220" onclick="javascript:pageTracker._trackPageview('/outbound/article/vimeo.com');">Data Parallelism in Haskell</a> from <a href="http://vimeo.com/user8218847" onclick="javascript:pageTracker._trackPageview('/outbound/article/vimeo.com');">Rob Manthey</a> on <a href="http://vimeo.com" onclick="javascript:pageTracker._trackPageview('/outbound/article/vimeo.com');">Vimeo</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tmorris.net/data-parallelism-in-haskell/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Lifting (Haskell addendum)</title>
		<link>http://blog.tmorris.net/lifting-haskell-addendum/</link>
		<comments>http://blog.tmorris.net/lifting-haskell-addendum/#comments</comments>
		<pubDate>Fri, 19 Aug 2011 01:03:38 +0000</pubDate>
		<dc:creator>Tony Morris</dc:creator>
		
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.tmorris.net/?p=1039</guid>
		<description><![CDATA[A follow-on from Lifting. A port of the Scala code to Haskell follows.

class Lift f where
  lift0 ::
    a -&#62; f a
&#160;
  lift1 ::
    &#40;a -&#62; b&#41; -&#62; f a -&#62; f b
  lift1 =
    ap . lift0
&#160;
  lift2 ::
   [...]]]></description>
			<content:encoded><![CDATA[<p>A follow-on from <a href="http://blog.tmorris.net/lifting/" >Lifting</a>. A port of the Scala code to Haskell follows.</p>

<div class="wp_syntax"><div class="code"><pre class="haskell"><span style="color: #06c; font-weight: bold;">class</span> Lift f <span style="color: #06c; font-weight: bold;">where</span>
  lift0 <span style="color: #339933; font-weight: bold;">::</span>
    a <span style="color: #339933; font-weight: bold;">-&gt;</span> f a
&nbsp;
  lift1 <span style="color: #339933; font-weight: bold;">::</span>
    <span style="color: green;">&#40;</span>a <span style="color: #339933; font-weight: bold;">-&gt;</span> b<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">-&gt;</span> f a <span style="color: #339933; font-weight: bold;">-&gt;</span> f b
  lift1 <span style="color: #339933; font-weight: bold;">=</span>
    ap <span style="color: #339933; font-weight: bold;">.</span> lift0
&nbsp;
  lift2 <span style="color: #339933; font-weight: bold;">::</span>
    <span style="color: green;">&#40;</span>a <span style="color: #339933; font-weight: bold;">-&gt;</span> b <span style="color: #339933; font-weight: bold;">-&gt;</span> c<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">-&gt;</span> f a <span style="color: #339933; font-weight: bold;">-&gt;</span> f b <span style="color: #339933; font-weight: bold;">-&gt;</span> f c
  lift2 f <span style="color: #339933; font-weight: bold;">=</span>
    ap <span style="color: #339933; font-weight: bold;">.</span> lift1 f
&nbsp;
  lift3 <span style="color: #339933; font-weight: bold;">::</span>
    <span style="color: green;">&#40;</span>a <span style="color: #339933; font-weight: bold;">-&gt;</span> b <span style="color: #339933; font-weight: bold;">-&gt;</span> c <span style="color: #339933; font-weight: bold;">-&gt;</span> d<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">-&gt;</span> f a <span style="color: #339933; font-weight: bold;">-&gt;</span> f b <span style="color: #339933; font-weight: bold;">-&gt;</span> f c <span style="color: #339933; font-weight: bold;">-&gt;</span> f d
  lift3 f a <span style="color: #339933; font-weight: bold;">=</span>
    ap <span style="color: #339933; font-weight: bold;">.</span> lift2 f a
&nbsp;
  ap <span style="color: #339933; font-weight: bold;">::</span>
    f <span style="color: green;">&#40;</span>a <span style="color: #339933; font-weight: bold;">-&gt;</span> b<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">-&gt;</span> f a <span style="color: #339933; font-weight: bold;">-&gt;</span> f b
&nbsp;
<span style="color: #5d478b; font-style: italic;">-- scala.List</span>
<span style="color: #06c; font-weight: bold;">instance</span> Lift <span style="color: green;">&#91;</span><span style="color: green;">&#93;</span> <span style="color: #06c; font-weight: bold;">where</span>
  lift0 <span style="color: #339933; font-weight: bold;">=</span>
    <span style="font-weight: bold;">error</span> <span style="background-color: #3cb371;">&quot;todo&quot;</span>
&nbsp;
  ap <span style="color: #339933; font-weight: bold;">=</span> 
    <span style="font-weight: bold;">error</span> <span style="background-color: #3cb371;">&quot;todo&quot;</span>
&nbsp;
<span style="color: #5d478b; font-style: italic;">-- scala.Option</span>
<span style="color: #06c; font-weight: bold;">instance</span> Lift <span style="color: #cccc00; font-weight: bold;">Maybe</span> <span style="color: #06c; font-weight: bold;">where</span>
  lift0 <span style="color: #339933; font-weight: bold;">=</span>
    <span style="font-weight: bold;">error</span> <span style="background-color: #3cb371;">&quot;todo&quot;</span>
&nbsp;
  ap <span style="color: #339933; font-weight: bold;">=</span> 
    <span style="font-weight: bold;">error</span> <span style="background-color: #3cb371;">&quot;todo&quot;</span>
&nbsp;
<span style="color: #5d478b; font-style: italic;">-- scala.Either[R, _]</span>
<span style="color: #06c; font-weight: bold;">instance</span> Lift <span style="color: green;">&#40;</span><span style="color: #cccc00; font-weight: bold;">Either</span> r<span style="color: green;">&#41;</span> <span style="color: #06c; font-weight: bold;">where</span>
  lift0 <span style="color: #339933; font-weight: bold;">=</span>
    <span style="font-weight: bold;">error</span> <span style="background-color: #3cb371;">&quot;todo&quot;</span>
&nbsp;
  ap <span style="color: #339933; font-weight: bold;">=</span> 
    <span style="font-weight: bold;">error</span> <span style="background-color: #3cb371;">&quot;todo&quot;</span>
&nbsp;
<span style="color: #5d478b; font-style: italic;">-- scala.Functior1[R, _]</span>
<span style="color: #06c; font-weight: bold;">instance</span> Lift <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span><span style="color: #339933; font-weight: bold;">-&gt;</span><span style="color: green;">&#41;</span> r<span style="color: green;">&#41;</span> <span style="color: #06c; font-weight: bold;">where</span>
  lift0 <span style="color: #339933; font-weight: bold;">=</span>
    <span style="font-weight: bold;">error</span> <span style="background-color: #3cb371;">&quot;todo&quot;</span>
&nbsp;
  ap <span style="color: #339933; font-weight: bold;">=</span> 
    <span style="font-weight: bold;">error</span> <span style="background-color: #3cb371;">&quot;todo&quot;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.tmorris.net/lifting-haskell-addendum/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Java 7</title>
		<link>http://blog.tmorris.net/java-7/</link>
		<comments>http://blog.tmorris.net/java-7/#comments</comments>
		<pubDate>Thu, 18 Aug 2011 11:06:13 +0000</pubDate>
		<dc:creator>Tony Morris</dc:creator>
		
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.tmorris.net/?p=1030</guid>
		<description><![CDATA[Java 7 has proposed syntax for what Scala calls two methods:


            Option.flatMap
             In Scala where we would normally write:

&#40;a, b, c, d&#41; =&#62; for &#123;
  aa &#60;- a&#40;argsa&#41;
  bb &#60;- [...]]]></description>
			<content:encoded><![CDATA[<p>Java 7 has proposed syntax for what Scala calls two methods:</p>
<ol>
<li>
            <code>Option.flatMap</code><br />
             In Scala where we would normally write:</p>

<div class="wp_syntax"><div class="code"><pre class="scala"><span style="color: #F78811;">&#40;</span>a, b, c, d<span style="color: #F78811;">&#41;</span> <span style="color: #000080;">=&gt;</span> <span style="color: #0000ff; font-weight: bold;">for</span> <span style="color: #F78811;">&#123;</span>
  aa <span style="color: #000080;">&lt;</span>- a<span style="color: #F78811;">&#40;</span>argsa<span style="color: #F78811;">&#41;</span>
  bb <span style="color: #000080;">&lt;</span>- b<span style="color: #F78811;">&#40;</span>argsb<span style="color: #F78811;">&#41;</span>
  cc <span style="color: #000080;">&lt;</span>- c<span style="color: #F78811;">&#40;</span>argsc<span style="color: #F78811;">&#41;</span>
  dd <span style="color: #000080;">&lt;</span>- d<span style="color: #F78811;">&#40;</span>argsd<span style="color: #F78811;">&#41;</span>
<span style="color: #F78811;">&#125;</span> <span style="color: #0000ff; font-weight: bold;">yield</span> f<span style="color: #F78811;">&#40;</span>aa, bb, cc, dd<span style="color: #F78811;">&#41;</span></pre></div></div>

<p>            While in Java we write:</p>

<div class="wp_syntax"><div class="code"><pre class="java"><span style="color: #666666; font-style: italic;">// ceremony in the absence of closures</span>
<span style="color: #666666; font-style: italic;">// has been omitted (and altered slightly) for brevity</span>
a<span style="color: #009900;">&#40;</span>argsa<span style="color: #009900;">&#41;</span><span style="color: #339933;">?</span>.<span style="color: #006633;">b</span><span style="color: #009900;">&#40;</span>argsb<span style="color: #009900;">&#41;</span><span style="color: #339933;">?</span>.<span style="color: #006633;">c</span><span style="color: #009900;">&#40;</span>argsc<span style="color: #009900;">&#41;</span><span style="color: #339933;">?</span>.<span style="color: #006633;">d</span><span style="color: #009900;">&#40;</span>argsd<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">f</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>            This syntax denotes the bind operation of <code>Option</code> monad, while Scala&#8217;s for-comprehension works for <em>any</em> monad. A pedantic point of note is that, from a particular perspective, Java&#8217;s syntax is slightly weaker than monad syntax, in that it is in fact, an applicative functor comprehension (not monad), since subsequent computations do not have access to previously computed values along the chain (if this is confuzzling, never mind &#8212; it&#8217;s important point otherwise, but not so much here). Scala&#8217;s for-comprehensions allow this, but it hasn&#8217;t been demonstrated above.
        </li>
<li>Option.getOrElse</li>
<p>        Java calls this <code>?:</code>, so while in Scala we might write <code>value getOrElse k</code>, or if you prefer Scalaz, <code>value | k</code>, in Java we&#8217;d write <code>value ?: k</code>. The Java version maintains the usual lack of safety of <code>null</code>, while Scala uses an algebraic data type.
</ol>
<p>Among many differences between Scala and Java here, one is that Scala does not introduce syntax for these two specific functions &#8212; after all, why would you? Further, what about the zillions of other useful functions? Java has no user-defined call-by-need unification, which means it is not possible to write <code>?:</code> yourself (even with a different valid Java identifier as a name). <a href="http://blog.tmorris.net/a-fling-with-lazy-evaluation/" >I wrote about this once before</a>. I expect this is the reason for introduction of syntax for representing individual functions.</p>
<p>Scala&#8217;s representation is also safer, in that it uses a data structure to denote <em>a list with a maximum length of one</em>, rather than <em>a value with type T, oh wait, just kidding, it might be null!</em></p>
<p>My favourite part of Java&#8217;s proposed introduction of syntax for two very specific functions (among hundreds of others), watered down to be not-quite-as-useful, is the assurance that I am still going to hear about how Scala is complex, while Java is not. Fun times.</p>
<p><em>Edit: Proposed Java syntax.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tmorris.net/java-7/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Lifting</title>
		<link>http://blog.tmorris.net/lifting/</link>
		<comments>http://blog.tmorris.net/lifting/#comments</comments>
		<pubDate>Sun, 17 Jul 2011 00:57:29 +0000</pubDate>
		<dc:creator>Tony Morris</dc:creator>
		
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.tmorris.net/?p=1025</guid>
		<description><![CDATA[Below is a compileable Scala source file. If you read it from top to bottom, it may help with some insights regarding applicative functors. It was partially inspired by Eric&#8217;s rendition of The Essence of the Iterator Pattern.

trait Lift&#91;F&#91;_&#93;&#93; &#123;
  // Spot the pattern in these type signatures
  // of increasing arity.
&#160;
  [...]]]></description>
			<content:encoded><![CDATA[<p>Below is a compileable Scala source file. If you read it from top to bottom, it may help with some insights regarding applicative functors. It was partially inspired by Eric&#8217;s rendition of <a href="http://etorreborre.blogspot.com/2011/06/essence-of-iterator-pattern.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/etorreborre.blogspot.com');">The Essence of the Iterator Pattern</a>.</p>

<div class="wp_syntax"><div class="code"><pre class="scala"><span style="color: #0000ff; font-weight: bold;">trait</span> Lift<span style="color: #F78811;">&#91;</span>F<span style="color: #F78811;">&#91;</span><span style="color: #000080;">_</span><span style="color: #F78811;">&#93;</span><span style="color: #F78811;">&#93;</span> <span style="color: #F78811;">&#123;</span>
  <span style="color: #008000; font-style: italic;">// Spot the pattern in these type signatures</span>
  <span style="color: #008000; font-style: italic;">// of increasing arity.</span>
&nbsp;
  <span style="color: #0000ff; font-weight: bold;">def</span> lift0<span style="color: #F78811;">&#91;</span>A<span style="color: #F78811;">&#93;</span><span style="color: #000080;">:</span>
    A <span style="color: #000080;">=&gt;</span> F<span style="color: #F78811;">&#91;</span>A<span style="color: #F78811;">&#93;</span>
&nbsp;
  <span style="color: #0000ff; font-weight: bold;">def</span> lift1<span style="color: #F78811;">&#91;</span>A, B<span style="color: #F78811;">&#93;</span><span style="color: #000080;">:</span>
    <span style="color: #F78811;">&#40;</span>A <span style="color: #000080;">=&gt;</span> B<span style="color: #F78811;">&#41;</span> <span style="color: #000080;">=&gt;</span> <span style="color: #F78811;">&#40;</span>F<span style="color: #F78811;">&#91;</span>A<span style="color: #F78811;">&#93;</span> <span style="color: #000080;">=&gt;</span> F<span style="color: #F78811;">&#91;</span>B<span style="color: #F78811;">&#93;</span><span style="color: #F78811;">&#41;</span>
&nbsp;
  <span style="color: #0000ff; font-weight: bold;">def</span> lift2<span style="color: #F78811;">&#91;</span>A, B, C<span style="color: #F78811;">&#93;</span><span style="color: #000080;">:</span>
    <span style="color: #F78811;">&#40;</span>A <span style="color: #000080;">=&gt;</span> B <span style="color: #000080;">=&gt;</span> C<span style="color: #F78811;">&#41;</span> <span style="color: #000080;">=&gt;</span> <span style="color: #F78811;">&#40;</span>F<span style="color: #F78811;">&#91;</span>A<span style="color: #F78811;">&#93;</span> <span style="color: #000080;">=&gt;</span> F<span style="color: #F78811;">&#91;</span>B<span style="color: #F78811;">&#93;</span> <span style="color: #000080;">=&gt;</span> F<span style="color: #F78811;">&#91;</span>C<span style="color: #F78811;">&#93;</span><span style="color: #F78811;">&#41;</span>
&nbsp;
  <span style="color: #0000ff; font-weight: bold;">def</span> lift3<span style="color: #F78811;">&#91;</span>A, B, C, D<span style="color: #F78811;">&#93;</span><span style="color: #000080;">:</span>
    <span style="color: #F78811;">&#40;</span>A <span style="color: #000080;">=&gt;</span> B <span style="color: #000080;">=&gt;</span> C <span style="color: #000080;">=&gt;</span> D<span style="color: #F78811;">&#41;</span> <span style="color: #000080;">=&gt;</span> <span style="color: #F78811;">&#40;</span>F<span style="color: #F78811;">&#91;</span>A<span style="color: #F78811;">&#93;</span> <span style="color: #000080;">=&gt;</span> F<span style="color: #F78811;">&#91;</span>B<span style="color: #F78811;">&#93;</span> <span style="color: #000080;">=&gt;</span> F<span style="color: #F78811;">&#91;</span>C<span style="color: #F78811;">&#93;</span> <span style="color: #000080;">=&gt;</span> F<span style="color: #F78811;">&#91;</span>D<span style="color: #F78811;">&#93;</span><span style="color: #F78811;">&#41;</span>
&nbsp;
  <span style="color: #008000; font-style: italic;">// ... and so on</span>
&nbsp;
  <span style="color: #008000; font-style: italic;">// The relationship between lift&lt;N&gt; and lift&lt;N-1&gt;</span>
  <span style="color: #008000; font-style: italic;">// can be given by a function,</span>
&nbsp;
  <span style="color: #0000ff; font-weight: bold;">def</span> ap<span style="color: #F78811;">&#91;</span>A, B<span style="color: #F78811;">&#93;</span><span style="color: #000080;">:</span>
    F<span style="color: #F78811;">&#91;</span>A <span style="color: #000080;">=&gt;</span> B<span style="color: #F78811;">&#93;</span> <span style="color: #000080;">=&gt;</span> <span style="color: #F78811;">&#40;</span>F<span style="color: #F78811;">&#91;</span>A<span style="color: #F78811;">&#93;</span> <span style="color: #000080;">=&gt;</span> F<span style="color: #F78811;">&#91;</span>B<span style="color: #F78811;">&#93;</span><span style="color: #F78811;">&#41;</span>
<span style="color: #F78811;">&#125;</span>
&nbsp;
<span style="color: #0000ff; font-weight: bold;">trait</span> LiftImpl<span style="color: #F78811;">&#91;</span>F<span style="color: #F78811;">&#91;</span><span style="color: #000080;">_</span><span style="color: #F78811;">&#93;</span><span style="color: #F78811;">&#93;</span> <span style="color: #0000ff; font-weight: bold;">extends</span> Lift<span style="color: #F78811;">&#91;</span>F<span style="color: #F78811;">&#93;</span> <span style="color: #F78811;">&#123;</span>
  <span style="color: #008000; font-style: italic;">// Each lift function uses</span>
  <span style="color: #008000; font-style: italic;">// the previous lift function and ap.</span>
&nbsp;
  <span style="color: #0000ff; font-weight: bold;">def</span> lift1<span style="color: #F78811;">&#91;</span>A, B<span style="color: #F78811;">&#93;</span><span style="color: #000080;">:</span>
    <span style="color: #F78811;">&#40;</span>A <span style="color: #000080;">=&gt;</span> B<span style="color: #F78811;">&#41;</span> <span style="color: #000080;">=&gt;</span> <span style="color: #F78811;">&#40;</span>F<span style="color: #F78811;">&#91;</span>A<span style="color: #F78811;">&#93;</span> <span style="color: #000080;">=&gt;</span> F<span style="color: #F78811;">&#91;</span>B<span style="color: #F78811;">&#93;</span><span style="color: #F78811;">&#41;</span>
    <span style="color: #000080;">=</span> ap compose lift0
&nbsp;
  <span style="color: #0000ff; font-weight: bold;">def</span> lift2<span style="color: #F78811;">&#91;</span>A, B, C<span style="color: #F78811;">&#93;</span><span style="color: #000080;">:</span>
    <span style="color: #F78811;">&#40;</span>A <span style="color: #000080;">=&gt;</span> B <span style="color: #000080;">=&gt;</span> C<span style="color: #F78811;">&#41;</span> <span style="color: #000080;">=&gt;</span> <span style="color: #F78811;">&#40;</span>F<span style="color: #F78811;">&#91;</span>A<span style="color: #F78811;">&#93;</span> <span style="color: #000080;">=&gt;</span> F<span style="color: #F78811;">&#91;</span>B<span style="color: #F78811;">&#93;</span> <span style="color: #000080;">=&gt;</span> F<span style="color: #F78811;">&#91;</span>C<span style="color: #F78811;">&#93;</span><span style="color: #F78811;">&#41;</span>
    <span style="color: #000080;">=</span> f <span style="color: #000080;">=&gt;</span> ap compose lift1<span style="color: #F78811;">&#40;</span>f<span style="color: #F78811;">&#41;</span>
&nbsp;
  <span style="color: #0000ff; font-weight: bold;">def</span> lift3<span style="color: #F78811;">&#91;</span>A, B, C, D<span style="color: #F78811;">&#93;</span><span style="color: #000080;">:</span>
    <span style="color: #F78811;">&#40;</span>A <span style="color: #000080;">=&gt;</span> B <span style="color: #000080;">=&gt;</span> C <span style="color: #000080;">=&gt;</span> D<span style="color: #F78811;">&#41;</span> <span style="color: #000080;">=&gt;</span> <span style="color: #F78811;">&#40;</span>F<span style="color: #F78811;">&#91;</span>A<span style="color: #F78811;">&#93;</span> <span style="color: #000080;">=&gt;</span> F<span style="color: #F78811;">&#91;</span>B<span style="color: #F78811;">&#93;</span> <span style="color: #000080;">=&gt;</span> F<span style="color: #F78811;">&#91;</span>C<span style="color: #F78811;">&#93;</span> <span style="color: #000080;">=&gt;</span> F<span style="color: #F78811;">&#91;</span>D<span style="color: #F78811;">&#93;</span><span style="color: #F78811;">&#41;</span>
    <span style="color: #000080;">=</span> f <span style="color: #000080;">=&gt;</span> a <span style="color: #000080;">=&gt;</span> ap compose lift2<span style="color: #F78811;">&#40;</span>f<span style="color: #F78811;">&#41;</span><span style="color: #F78811;">&#40;</span>a<span style="color: #F78811;">&#41;</span>
<span style="color: #F78811;">&#125;</span>
&nbsp;
<span style="color: #008000; font-style: italic;">// Notes</span>
<span style="color: #008000; font-style: italic;">// * lift0 is often called: unit, return, pure, point, η</span>
<span style="color: #008000; font-style: italic;">// * lift1 is often called: fmap, map, ∘</span>
<span style="color: #008000; font-style: italic;">// * lift&lt;N&gt; is often called: liftA&lt;N&gt;, liftM&lt;N&gt;</span></pre></div></div>

<p>All that is left to do is to implement the <code>LiftImpl</code> trait! You can do this by implementing the <code>ap</code> and <code>lift0</code> functions.</p>
<p>Examples of implementations that I know will work out if you try to implement them:</p>
<li><code>class ListLift extends LiftImpl[List]</code></li>
<li><code>class OptionLift extends LiftImpl[Option]</code></li>
<li><code>class EitherLift[R] extends LiftImpl[({type λ[α] = Either[R, α]})#λ]</code></li>
<li><code>class Function1Lift[R] extends LiftImpl[({type λ[α] = R => α})#λ]</code></li>
<p>Those last couple are a bit funky, but a lot of that is syntax noise rather than anything too complicated. Fill out the body of those classes!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tmorris.net/lifting/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Three and a half friggin years later</title>
		<link>http://blog.tmorris.net/three-and-a-half-friggin-years-later/</link>
		<comments>http://blog.tmorris.net/three-and-a-half-friggin-years-later/#comments</comments>
		<pubDate>Sat, 30 Apr 2011 10:24:03 +0000</pubDate>
		<dc:creator>Tony Morris</dc:creator>
		
		<category><![CDATA[Health]]></category>

		<guid isPermaLink="false">http://blog.tmorris.net/?p=1009</guid>
		<description><![CDATA[The result of:

The purchase and consumption of 31 medical text books on lower limb orthopaedics, neurology, neuro and spinal surgery and radiology.
Uncountable subscriptions to medical journals.
18 MRIs, 4 CAT scans, 3 XRAY scans, 3 bone scans.
12 surgical procedures; 8 to the lower limb, 3 to the lumbar spine. 1 (successfully) minor procedure performed by myself [...]]]></description>
			<content:encoded><![CDATA[<p>The result of:</p>
<ul>
<li>The purchase and consumption of 31 medical text books on lower limb orthopaedics, neurology, neuro and spinal surgery and radiology.</li>
<li>Uncountable subscriptions to medical journals.</li>
<li>18 MRIs, 4 CAT scans, 3 XRAY scans, 3 bone scans.</li>
<li>12 surgical procedures; 8 to the lower limb, 3 to the lumbar spine. 1 (successfully) minor procedure performed by myself for a medical emergency for which acknowledgement was initially refused and later accepted after surgical extraction of foreign body.</li>
<li>29 doctors</li>
<li>AU$130K <em>(total estimated)</em></li>
<li>Having been misdiagnosed by a not-so-clever person named Dr Leigh Atkinson, including the suggestion that my chronic pain is &#8220;caused by the holy ghost.&#8221; Yes, seriously, he said this &#8212; while also in the room with a qualified medical professional (whom he called delusional in the same rant). He also claimed that I did not have Entrapment Neuropathy of SPN when I told him I strongly suspected it. I did &#8212; surgically verified by lower limb orthopaedic specialist (November 2009).</li>
<li>Having been repeatedly told for nearly two years by Dr Michael McEniery, who would threaten to sue me again if I was to call him incompetent or dangerous (even though this might be my genuinely held opinion based on substantiated fact and so he would lose) that I am obsessing about a minor condition, requiring no medical intervention, and that this obsession is because of the athletic demands of myself and my coach.</li>
<li>Having executed a partially-successful mission to demand immediate medical attention in March 2009 at significant expense.</li>
</ul>
<p>I have successfully and single-handedly diagnosed:</p>
<ul>
<li>Entrapment Neuropathy of the Superficial Peroneal Nerve, 10cm proximal to lateral malleolus (unilateral).</li>
<li>Foraminal Stenosis of the Fifth Lumbar (L5) Nerve Root (unilateral).</li>
<li>Spinal instability (Spondylolisthesis) at Fifth Lumbar (L5).</li>
<li>Withdrawal from morphine and oxycodone after immediate cessation.</li>
</ul>
<p>These conditions were caused by a single acute sporting injury in July 2007. I have been treated for all.</p>
<p>L4,L5,S1 fusion 15 March 2011<br />
<img src="http://i.imgur.com/t0InY.jpg" alt="L4,L5,S1 Image" /></p>
<p>PS: This is why I sometimes demonstrate low tolerance for stupidity and/or failure or refusal to entertain the possibility of thinking. People get hurt. No, I am not sorry.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tmorris.net/three-and-a-half-friggin-years-later/feed/</wfw:commentRss>
		</item>
		<item>
		<title>A brief point on static typing</title>
		<link>http://blog.tmorris.net/a-brief-point-on-static-typing/</link>
		<comments>http://blog.tmorris.net/a-brief-point-on-static-typing/#comments</comments>
		<pubDate>Sat, 26 Mar 2011 02:29:47 +0000</pubDate>
		<dc:creator>Tony Morris</dc:creator>
		
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.tmorris.net/?p=1002</guid>
		<description><![CDATA[This post also incidentally attempts to justify my answer to a question that I regularly encounter, what is your favourite programming language?

It&#8217;s not possible to write bug-free programs.

This particular myth is quite popular, and its recent inclusion in a discussion I had has prompted me to write this post. The profound fact of this matter [...]]]></description>
			<content:encoded><![CDATA[<p>This post also incidentally attempts to justify my answer to a question that I regularly encounter, <em>what is your favourite programming language?</em></p>
<blockquote><p>
It&#8217;s not possible to write bug-free programs.
</p></blockquote>
<p>This particular myth is quite popular, and its recent inclusion in a discussion I had has prompted me to write this post. The profound fact of this matter is that this statement is &#8220;as false as you can get.&#8221; In other words, there exists a formal proof of its negation, and subsequent counter-examples. It has also been my experience that belief in this myth has degenerative practical implications.</p>
<p>To emphasise the point, there exist programming languages for which <em>it is impossible to write an incorrect program</em>. What does it mean for a program to be correct? It means the program <em>terminates</em>. Such languages include (in order of my decreasing experience with them): Coq, Agda, Epigram, Isabelle.</p>
<p>Some people like to think &#8220;correctness&#8221; includes the thoughts of one or more persons in order to make the assessment. For example, one might proclaim, &#8220;sure you have a proof of program termination, but that is not the program that I asked for!&#8221; I think this is a poor use of the term &#8220;correctness&#8221; and I am not considering it any further here.</p>
<p>There is a problem with the aforementioned programming languages. A big one. While you always have correct programs in these languages, <em>you cannot have all general programs</em>. This is a well-documented contention. So you might say that these languages set out to achieve the objective of emphasising correctness, but at the expense of generality &#8212; in other words, they are exploring the question: &#8220;just how general and practical can we get, without sacrificing absolute correctness?&#8221; In my opinion, this is a very important question and worthy of further research.</p>
<p>Other programming languages sacrifice correctness for generality. In my typical work (I work for a product company), this includes languages such as Haskell, Scala and even Scala&#8217;s type system (which can be used as an embedded language). I expect most of my readers fall into this category of usage of languages. That is, we are all using languages that explore the question: &#8220;just how correct and practical can we get, without sacrificing generality?&#8221; In my opinion, this is a very important question too.</p>
<p>In the pursuit of answering both of the above questions, there are a number of contentions that arise. This means that there is not a <em>holy grail</em> programming language. It also means that there is a lot to understand before even starting to talk about the merits of correctness (aka static typing). This is unfortunate given the strong compulsion for, and quality of, popular commentary &#8212; we spend too much time clearing up myths. I digress.</p>
<p>However, this issue of contentions and trade-offs does not preclude the existence of questions of dismissal of programming languages. That is, it is possible to ask, and even answer, the question of whether or not there are programming languages that offer nothing toward resolving all of these (meaningful) contentions with respect to peer programming languages. These programming languages may be dismissed as offering nothing toward the goals of computability. It may be said that they are &#8220;universally impractical&#8221; with respect to the goals of computability (I am explicitly distinguishing here from social objectives). This may seem pessimistic, but it&#8217;s just a fact of the matter.</p>
<p>I hope that helps.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tmorris.net/a-brief-point-on-static-typing/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>

