<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>blog :: Brent -&#62; [String]</title>
	<atom:link href="http://byorgey.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://byorgey.wordpress.com</link>
	<description></description>
	<lastBuildDate>Tue, 24 Jan 2012 18:57:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='byorgey.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>blog :: Brent -&#62; [String]</title>
		<link>http://byorgey.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://byorgey.wordpress.com/osd.xml" title="blog :: Brent -&#62; [String]" />
	<atom:link rel='hub' href='http://byorgey.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Parsing context-sensitive languages with Applicative</title>
		<link>http://byorgey.wordpress.com/2012/01/05/parsing-context-sensitive-languages-with-applicative/</link>
		<comments>http://byorgey.wordpress.com/2012/01/05/parsing-context-sensitive-languages-with-applicative/#comments</comments>
		<pubDate>Thu, 05 Jan 2012 05:21:03 +0000</pubDate>
		<dc:creator>Brent</dc:creator>
				<category><![CDATA[haskell]]></category>
		<category><![CDATA[applicative]]></category>
		<category><![CDATA[context-free]]></category>
		<category><![CDATA[context-sensitive]]></category>
		<category><![CDATA[grammars]]></category>
		<category><![CDATA[infinite]]></category>
		<category><![CDATA[monad]]></category>
		<category><![CDATA[parsing]]></category>

		<guid isPermaLink="false">http://byorgey.wordpress.com/?p=746</guid>
		<description><![CDATA[Many parser combinator libraries in Haskell (such as parsec) have both a Monad interface as well as an Applicative interface. (Actually, to be really useful, you also need MonadPlus along with Monad, or Alternative along with Applicative, in order to encode choice; from now on when I talk about Monad and Applicative note that I [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byorgey.wordpress.com&amp;blog=1152889&amp;post=746&amp;subd=byorgey&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Many parser combinator libraries in Haskell (such as <a href="http://hackage.haskell.org/package/parsec">parsec</a>) have both a <code>Monad</code> interface as well as an <code>Applicative</code> interface. (Actually, to be really useful, you also need <code>MonadPlus</code> along with <code>Monad</code>, or <code>Alternative</code> along with <code>Applicative</code>, in order to encode choice; from now on when I talk about <code>Monad</code> and <code>Applicative</code> note that I really have <code>MonadPlus</code> or <code>Alternative</code> in mind as well.) The <code>Applicative</code> interface is often nicer, but it is less powerful than the <code>Monad</code> interface: in particular, using <code>Applicative</code> you can only parse <a href="http://en.wikipedia.org/wiki/Context-free_language">context-free languages</a>, whereas <code>Monad</code> lets you parse arbitrary context-sensitive languages. Intuitively, this is because the structure of <code>Applicative</code> computations cannot depend on intermediate results, whereas <code>Monad</code> computations allow you to choose which computation to run next based on intermediate results.</p>
<p>This is a good bit of intuition, with only one minor caveat: it isn&#8217;t true! I believe it was two years ago, during the second <a href="http://www.haskell.org/haskellwiki/Hac_%CF%86">Hac phi</a>, when I first learned from <a href="http://comonad.com/reader/">Edward Kmett</a> how <code>Applicative</code> (by which I mean, of course, <code>Alternative</code>) can be used to parse arbitrary context-sensitive languages. The question just came up again in the <code>#haskell</code> IRC channel, and I figured it would be useful to have this all written down somewhere. In particular, Reid Barton gave a nice sketch which I decided to turn into some working code.</p>
<p>Here&#8217;s the key insight: normally, grammars are defined as <em>finite</em> objects: a finite set of terminals, a finite set of nonterminals, and a finite set of productions. However, Haskell&#8217;s general recursion means that we can write down a &quot;grammar&quot; with an <em>infinite</em> set of production rules. This is what lets us get away with parsing context-sensitive languages with <code>Applicative</code>: we just make a different production rule for every possible input!</p>
<p>First, some imports. Notice that I do <em>not</em> import <code>Control.Monad</code>.</p>
<pre><code><span>&gt;</span> <span style="color:blue;font-weight:bold;">import</span> <span>Text</span><span>.</span><span>Parsec</span>
<span>&gt;</span> <span style="color:blue;font-weight:bold;">import</span> <span>Text</span><span>.</span><span>Parsec</span><span>.</span><span>String</span>
<span>&gt;</span> <span style="color:blue;font-weight:bold;">import</span> <span>Control</span><span>.</span><span>Arrow</span> <span style="color:red;">(</span><span style="color:red;">(</span><span>&amp;&amp;&amp;</span><span style="color:red;">)</span><span style="color:red;">)</span>
<span>&gt;</span> <span style="color:blue;font-weight:bold;">import</span> <span>Control</span><span>.</span><span>Applicative</span> <span>hiding</span> <span style="color:red;">(</span><span style="color:red;">(</span><span>&lt;|&gt;</span><span style="color:red;">)</span><span style="color:red;">)</span>
<span>&gt;</span> <span style="color:blue;font-weight:bold;">import</span> <span>Data</span><span>.</span><span>List</span> <span style="color:red;">(</span><span>group</span><span style="color:red;">)</span>
</code></pre>
<p>The usual <code>guard</code> function is for <code>MonadPlus</code>, but we can make something equivalent for <code>Alternative</code>.</p>
<pre><code><span>&gt;</span> <span>guard'</span> <span style="color:red;">::</span> <span>Alternative</span> <span>f</span> <span style="color:red;">=&gt;</span> <span>Bool</span> <span style="color:red;">-&gt;</span> <span>f</span> <span>()</span>
<span>&gt;</span> <span>guard'</span> <span>True</span>  <span style="color:red;">=</span> <span>pure</span> <span>()</span>
<span>&gt;</span> <span>guard'</span> <span>False</span> <span style="color:red;">=</span> <span>empty</span>
</code></pre>
<p>And now for the meat of the example. <code>parseArbitrary</code> takes an arbitrary predicate on <code>Strings</code> built from lowercase letters and turns it into a parser. The created parser will accept <code>Strings</code> for which the predicate evaluates to <code>True</code> (returning <code>()</code>) and fail for any other string.</p>
<pre><code><span>&gt;</span> <span>parseArbitrary</span> <span style="color:red;">::</span> <span style="color:red;">(</span><span>String</span> <span style="color:red;">-&gt;</span> <span>Bool</span><span style="color:red;">)</span> <span style="color:red;">-&gt;</span> <span>Parser</span> <span>()</span>
<span>&gt;</span> <span>parseArbitrary</span> <span>p</span> <span style="color:red;">=</span>
</code></pre>
<p>If we encounter <code>eof</code>, we simply ensure that the predicate holds of the empty string.</p>
<pre><code><span>&gt;</span>       <span style="color:red;">(</span><span>eof</span> <span>&lt;*</span> <span>guard'</span> <span style="color:red;">(</span><span>p</span> <span>[]</span><span style="color:red;">)</span><span style="color:red;">)</span>
</code></pre>
<p>Otherwise, we choose between 26 alternatives based on the next character in the input. If the character <code>c</code> is encountered, we make a recursive call to <code>parseArbitrary (p . (c:))</code>. The remainder of the input must satisfy <code>(p . (c:))</code>, that is, it must consist of some <code>String</code> <code>s</code> such that <code>(c:s)</code> satisfies the predicate <code>p</code>.</p>
<pre><code><span>&gt;</span>   <span>&lt;|&gt;</span> <span>foldr</span> <span style="color:red;">(</span><span>&lt;|&gt;</span><span style="color:red;">)</span> <span>parserZero</span>
<span>&gt;</span>         <span style="color:red;">(</span><span>map</span> <span style="color:red;">(</span><span style="color:red;">\</span><span>c</span> <span style="color:red;">-&gt;</span> <span>char</span> <span>c</span> <span>*&gt;</span>
<span>&gt;</span>                     <span>parseArbitrary</span> <span style="color:red;">(</span><span>p</span> <span>.</span> <span style="color:red;">(</span><span>c</span><span>:</span><span style="color:red;">)</span><span style="color:red;">)</span>
<span>&gt;</span>              <span style="color:red;">)</span>
<span>&gt;</span>              <span style="color:red;">[</span><span style="color:teal;">'a'</span><span style="color:red;">..</span><span style="color:teal;">'z'</span><span style="color:red;">]</span>
<span>&gt;</span>         <span style="color:red;">)</span>
</code></pre>
<p>For any given predicate <code>p</code>, you can think of <code>parseArbitrary p</code> as an infinite tree with a 26-way branch at each node. Each node &quot;remembers&quot; the path taken to reach it from the root of the tree, in the form of prepend functions composed with the original predicate. We have constructed an infinite grammar: each node in the tree corresponds to a production, one for every possible input prefix.</p>
<p>Let&#8217;s try it out. Here&#8217;s a function which only accepts <code>String</code>s of the form <code>&quot;aaabbbccc&quot;</code>, with an equal number of a&#8217;s, b&#8217;s, and c&#8217;s. This is a well-known example of a language which is not context-free (easily shown using the <a href="http://en.wikipedia.org/wiki/Pumping_lemma_for_context-free_languages">pumping lemma for context-free languages</a>).</p>
<pre><code><span>&gt;</span> <span>f</span> <span style="color:red;">::</span> <span>String</span> <span style="color:red;">-&gt;</span> <span>Bool</span>
<span>&gt;</span> <span>f</span> <span>s</span>
<span>&gt;</span>   <span style="color:red;">|</span> <span style="color:red;">[</span><span style="color:red;">(</span><span style="color:teal;">'a'</span><span style="color:red;">,</span><span>na</span><span style="color:red;">)</span><span style="color:red;">,</span> <span style="color:red;">(</span><span style="color:teal;">'b'</span><span style="color:red;">,</span><span>nb</span><span style="color:red;">)</span><span style="color:red;">,</span> <span style="color:red;">(</span><span style="color:teal;">'c'</span><span style="color:red;">,</span><span>nc</span><span style="color:red;">)</span><span style="color:red;">]</span>
<span>&gt;</span>     <span style="color:red;">&lt;-</span> <span>map</span> <span style="color:red;">(</span><span>head</span> <span>&amp;&amp;&amp;</span> <span>length</span><span style="color:red;">)</span><span>.</span> <span>group</span> <span>$</span> <span>s</span>
<span>&gt;</span>
<span>&gt;</span>     <span style="color:red;">=</span> <span>na</span> <span>==</span> <span>nb</span> <span>&amp;&amp;</span> <span>nb</span> <span>==</span> <span>nc</span>
<span>&gt;</span>
<span>&gt;</span>   <span style="color:red;">|</span> <span>otherwise</span> <span style="color:red;">=</span> <span>False</span>
</code></pre>
<p>Now we make <code>f</code> into a parser and test it on some example inputs:</p>
<pre><code><span>&gt;</span> <span>p</span> <span style="color:red;">=</span> <span>parseArbitrary</span> <span>f</span>
<span>&gt;</span>
<span>&gt;</span> <span>main</span> <span style="color:red;">=</span> <span style="color:blue;font-weight:bold;">do</span>
<span>&gt;</span>   <span>parseTest</span> <span>p</span> <span style="color:teal;">"aaa"</span>
<span>&gt;</span>   <span>parseTest</span> <span>p</span> <span style="color:teal;">"aaabbbcc"</span>
<span>&gt;</span>   <span>parseTest</span> <span>p</span> <span style="color:teal;">"aaaabcccc"</span>
<span>&gt;</span>   <span>parseTest</span> <span>p</span> <span style="color:teal;">"aaaaabbbbbccccc"</span>
</code></pre>
<p>The last test succeeds by returning <code>()</code>. For the first three, we get error messages like this:</p>
<pre><code>parse error at (line 1, column 4):
unexpected end of input
expecting "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y" or "z"</code></pre>
<p>Obviously, these are not very helpful. But what were you expecting? <s>After all, this is one of those things that is interesting in theory, but in practice amounts to an awful hack that no one would ever want to use in real code.</p>
<p>In the end, it&#8217;s still true that <code>Applicative</code> can only parse context-free languages <em>as long as we restrict ourselves to finite grammars</em>&#8212;which any sensible programmer would do anyway.</s></p>
<p>[<b>ETA</b>: it looks like using infinite grammars is not as impractical as I thought---see the comments below!]</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/byorgey.wordpress.com/746/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/byorgey.wordpress.com/746/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/byorgey.wordpress.com/746/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/byorgey.wordpress.com/746/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/byorgey.wordpress.com/746/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/byorgey.wordpress.com/746/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/byorgey.wordpress.com/746/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/byorgey.wordpress.com/746/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/byorgey.wordpress.com/746/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/byorgey.wordpress.com/746/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/byorgey.wordpress.com/746/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/byorgey.wordpress.com/746/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/byorgey.wordpress.com/746/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/byorgey.wordpress.com/746/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byorgey.wordpress.com&amp;blog=1152889&amp;post=746&amp;subd=byorgey&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://byorgey.wordpress.com/2012/01/05/parsing-context-sensitive-languages-with-applicative/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/cc113924265dbeb535c8b2fefe4e33ee?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Brent</media:title>
		</media:content>
	</item>
		<item>
		<title>Typeclassopedia v2: moving my efforts to the Haskell wiki</title>
		<link>http://byorgey.wordpress.com/2011/11/26/typeclassopedia-v2-moving-my-efforts-to-the-haskell-wiki/</link>
		<comments>http://byorgey.wordpress.com/2011/11/26/typeclassopedia-v2-moving-my-efforts-to-the-haskell-wiki/#comments</comments>
		<pubDate>Sat, 26 Nov 2011 04:39:37 +0000</pubDate>
		<dc:creator>Brent</dc:creator>
				<category><![CDATA[haskell]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[writing]]></category>

		<guid isPermaLink="false">http://byorgey.wordpress.com/?p=740</guid>
		<description><![CDATA[I said back in April that I was going to be working on a second edition of the Typeclassopedia. Since then I have worked on it some, but mostly I&#8217;ve dithered trying to work out a toolchain for publishing it in multiple formats including PDF and (commentable) HTML. But it&#8217;s become increasingly clear to me [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byorgey.wordpress.com&amp;blog=1152889&amp;post=740&amp;subd=byorgey&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I <a href="http://byorgey.wordpress.com/2011/04/03/call-for-contributions-second-edition-of-the-typeclassopedia/" title="Call for contributions: second edition of the Typeclassopedia">said back in April</a> that I was going to be working on a second edition of the Typeclassopedia.  Since then I <i>have</i> worked on it some, but mostly I&#8217;ve dithered trying to work out a toolchain for publishing it in multiple formats including PDF and (commentable) HTML.  But it&#8217;s become increasingly clear to me that this is really just getting in the way of the important work of actually updating the content, and I ought to just choose a simple solution, imperfect though it may be, and get on with it.</p>
<p>In the meantime, it turns out that Henk Krauss (<a href="http://haskell.org/haskellwiki/User:Geheimdienst">geheimdienst</a>) has been doing the tedious work of <a href="http://haskell.org/haskellwiki/Typeclassopedia">porting the Typeclassopedia to the Haskell wiki</a> (thanks!).  It looks much nicer than I thought possible for a wiki page, allaying one particular misgiving I had about publishing in wiki format.  And this format obviously makes it extremely easy for others to contribute.</p>
<p>The path forward is clear: I hereby declare that <a href="http://haskell.org/haskellwiki/Typeclassopedia">the Haskell wiki version of the Typeclassopedia</a> is now the official version, and from now on I will be focusing my efforts there. You can expect a bunch of updates, improvements, and expansions over the next few months.  If you have any improvements to suggest, you can make them directly, or <a href="http://haskell.org/haskellwiki/index.php?title=Talk:Typeclassopedia&amp;action=edit">leave a comment on the talk page</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/byorgey.wordpress.com/740/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/byorgey.wordpress.com/740/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/byorgey.wordpress.com/740/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/byorgey.wordpress.com/740/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/byorgey.wordpress.com/740/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/byorgey.wordpress.com/740/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/byorgey.wordpress.com/740/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/byorgey.wordpress.com/740/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/byorgey.wordpress.com/740/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/byorgey.wordpress.com/740/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/byorgey.wordpress.com/740/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/byorgey.wordpress.com/740/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/byorgey.wordpress.com/740/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/byorgey.wordpress.com/740/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byorgey.wordpress.com&amp;blog=1152889&amp;post=740&amp;subd=byorgey&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://byorgey.wordpress.com/2011/11/26/typeclassopedia-v2-moving-my-efforts-to-the-haskell-wiki/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<georss:point>39.953605 -75.213937</georss:point>
		<geo:lat>39.953605</geo:lat>
		<geo:long>-75.213937</geo:long>
		<media:content url="http://0.gravatar.com/avatar/cc113924265dbeb535c8b2fefe4e33ee?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Brent</media:title>
		</media:content>
	</item>
		<item>
		<title>Modern art with diagrams: the face of progress</title>
		<link>http://byorgey.wordpress.com/2011/11/12/modern-art-with-diagrams-the-face-of-progress/</link>
		<comments>http://byorgey.wordpress.com/2011/11/12/modern-art-with-diagrams-the-face-of-progress/#comments</comments>
		<pubDate>Sat, 12 Nov 2011 18:23:56 +0000</pubDate>
		<dc:creator>Brent</dc:creator>
				<category><![CDATA[diagrams]]></category>
		<category><![CDATA[art]]></category>
		<category><![CDATA[bugs]]></category>
		<category><![CDATA[modern]]></category>
		<category><![CDATA[tiling]]></category>

		<guid isPermaLink="false">http://byorgey.wordpress.com/?p=734</guid>
		<description><![CDATA[As an addendum to my previous post, here are a few outputs generated while I was debugging: For extra credit, deduce what the bugs were. ;)<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byorgey.wordpress.com&amp;blog=1152889&amp;post=734&amp;subd=byorgey&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>As an addendum to my <a href="http://byorgey.wordpress.com/2011/11/12/generating-plane-tilings-with-diagrams/" title="Generating plane tilings with diagrams">previous post</a>, here are a few outputs generated while I was debugging:</p>
<p><a href="http://byorgey.files.wordpress.com/2011/11/tiling-wrong2.png"><img src="http://byorgey.files.wordpress.com/2011/11/tiling-wrong2.png?w=450" alt="" title="Tiling-wrong2"   class="aligncenter size-full wp-image-736" /></a></p>
<p><a href="http://byorgey.files.wordpress.com/2011/11/tiling-wrong3.png"><img src="http://byorgey.files.wordpress.com/2011/11/tiling-wrong3.png?w=450" alt="" title="Tiling-wrong3"   class="aligncenter size-full wp-image-737" /></a></p>
<p>For extra credit, deduce what the bugs were. ;)</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/byorgey.wordpress.com/734/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/byorgey.wordpress.com/734/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/byorgey.wordpress.com/734/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/byorgey.wordpress.com/734/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/byorgey.wordpress.com/734/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/byorgey.wordpress.com/734/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/byorgey.wordpress.com/734/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/byorgey.wordpress.com/734/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/byorgey.wordpress.com/734/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/byorgey.wordpress.com/734/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/byorgey.wordpress.com/734/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/byorgey.wordpress.com/734/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/byorgey.wordpress.com/734/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/byorgey.wordpress.com/734/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byorgey.wordpress.com&amp;blog=1152889&amp;post=734&amp;subd=byorgey&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://byorgey.wordpress.com/2011/11/12/modern-art-with-diagrams-the-face-of-progress/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<georss:point>39.953605 -75.213937</georss:point>
		<geo:lat>39.953605</geo:lat>
		<geo:long>-75.213937</geo:long>
		<media:content url="http://0.gravatar.com/avatar/cc113924265dbeb535c8b2fefe4e33ee?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Brent</media:title>
		</media:content>

		<media:content url="http://byorgey.files.wordpress.com/2011/11/tiling-wrong2.png" medium="image">
			<media:title type="html">Tiling-wrong2</media:title>
		</media:content>

		<media:content url="http://byorgey.files.wordpress.com/2011/11/tiling-wrong3.png" medium="image">
			<media:title type="html">Tiling-wrong3</media:title>
		</media:content>
	</item>
		<item>
		<title>Generating plane tilings with diagrams</title>
		<link>http://byorgey.wordpress.com/2011/11/12/generating-plane-tilings-with-diagrams/</link>
		<comments>http://byorgey.wordpress.com/2011/11/12/generating-plane-tilings-with-diagrams/#comments</comments>
		<pubDate>Sat, 12 Nov 2011 16:41:19 +0000</pubDate>
		<dc:creator>Brent</dc:creator>
				<category><![CDATA[diagrams]]></category>
		<category><![CDATA[haskell]]></category>
		<category><![CDATA[math]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[plane]]></category>
		<category><![CDATA[tiling]]></category>

		<guid isPermaLink="false">http://byorgey.wordpress.com/?p=697</guid>
		<description><![CDATA[I&#8217;ve finally set up a diagrams-contrib package to serve as a home for user contributions to the diagrams project&#8212;generation of specialized diagrams, fun or instructive examples, half-baked ideas, stuff which is not sufficiently polished or general to go in the diagrams-lib package but is nonetheless worth sharing. As the first &#8220;contribution&#8221; I put some code [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byorgey.wordpress.com&amp;blog=1152889&amp;post=697&amp;subd=byorgey&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve finally set up a <a href="https://patch-tag.com/r/byorgey/diagrams-contrib/home">diagrams-contrib package</a> to serve as a home for user contributions to the <a href="http://projects.haskell.org/diagrams">diagrams project</a>&#8212;generation of specialized diagrams, fun or instructive examples, half-baked ideas, stuff which is not sufficiently polished or general to go in the <a href="http://hackage.haskell.org/package/diagrams-lib">diagrams-lib package</a> but is nonetheless worth sharing.</p>
<p>As the first &#8220;contribution&#8221; I put some <a href="https://patch-tag.com/r/byorgey/diagrams-contrib/snapshot/current/content/pretty/src/Diagrams/TwoD/Tilings.hs">code I wrote for fun</a> that generates tilings of the Euclidean plane by regular polygons.</p>
<p><a href="http://byorgey.files.wordpress.com/2011/11/t3.png"><img src="http://byorgey.files.wordpress.com/2011/11/t3.png?w=450" alt="" title="t3"   class="size-full wp-image-699" /></a><a href="http://byorgey.files.wordpress.com/2011/11/t4.png"><img src="http://byorgey.files.wordpress.com/2011/11/t4.png?w=450" alt="" title="t4"   class="size-full wp-image-700" /></a><a href="http://byorgey.files.wordpress.com/2011/11/t33434.png"><img src="http://byorgey.files.wordpress.com/2011/11/t33434.png?w=450" alt="" title="t33434"   class="size-full wp-image-710" /></a><a href="http://byorgey.files.wordpress.com/2011/11/t3636.png"><img src="http://byorgey.files.wordpress.com/2011/11/t3636.png?w=450" alt="" title="t3636"   class="size-full wp-image-704" /></a></p>
<p>So how does it work?  I&#8217;m sure there are more clever ways if you understand the mathematics better; but essentially it does a depth-first search along the edge graph, stopping when it reaches some user-defined limit, and drawing polygons and edges along the way.  This sounds quite simple on the face of it; but there are two nontrivial problems to be worked out:</p>
<ol>
<li>How can we tell whether we&#8217;ve visited a given vertex before?</li>
<li>How do we represent a tiling in a way that lets us easily traverse its edge graph?</li>
</ol>
<p><a href="http://byorgey.files.wordpress.com/2011/11/t33344.png"><img src="http://byorgey.files.wordpress.com/2011/11/t33344.png?w=450" alt="" title="t33344"   class="size-full wp-image-709" /></a><a href="http://byorgey.files.wordpress.com/2011/11/t488.png"><img src="http://byorgey.files.wordpress.com/2011/11/t488.png?w=450" alt="" title="t488"   class="size-full wp-image-702" /></a></p>
<p>The first question is really a question of <i>representation</i>: how do we represent vertices in such a way that we can decide their equality?  Representing them with a pair of floating point coordinates does not work: taking two different paths to a vertex will surely result in slightly different coordinates due to floating point error. Another idea is to represent vertices by the <i>path</i> taken to reach them, but now we have to deal with the thorny problem of deciding when two paths are equivalent.</p>
<p>But it turns out we can do something a bit more clever. The only regular polygons that can appear in plane tilings are triangles, squares, hexagons, octagons, and dodecagons.  If you remember your high school trigonometry, these all have &#8220;special&#8221; angles whose sines and cosines can be represented exactly using square roots.  It suffices to work in <img src='http://s0.wp.com/latex.php?latex=%5Cmathbb%7BQ%7D%5B%5Csqrt%7B2%7D%2C+%5Csqrt%7B3%7D%5D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;mathbb{Q}[&#92;sqrt{2}, &#92;sqrt{3}]' title='&#92;mathbb{Q}[&#92;sqrt{2}, &#92;sqrt{3}]' class='latex' />, that is, the ring of rational numbers adjoined with <img src='http://s0.wp.com/latex.php?latex=%5Csqrt%7B2%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;sqrt{2}' title='&#92;sqrt{2}' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=%5Csqrt%7B3%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;sqrt{3}' title='&#92;sqrt{3}' class='latex' />.  Put simply, we use quadruples of rational numbers <img src='http://s0.wp.com/latex.php?latex=%28a%2Cb%2Cc%2Cd%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='(a,b,c,d)' title='(a,b,c,d)' class='latex' /> which represent the real number <img src='http://s0.wp.com/latex.php?latex=a+%2B+b%5Csqrt%7B2%7D+%2B+c%5Csqrt%7B3%7D+%2B+d%5Csqrt%7B6%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='a + b&#92;sqrt{2} + c&#92;sqrt{3} + d&#92;sqrt{6}' title='a + b&#92;sqrt{2} + c&#92;sqrt{3} + d&#92;sqrt{6}' class='latex' />.  Now we can represent vertices <i>exactly</i>, so remembering which we&#8217;ve already visited is easy.</p>
<p><a href="http://byorgey.files.wordpress.com/2011/11/t33336r.png"><img src="http://byorgey.files.wordpress.com/2011/11/t33336r.png?w=450" alt="" title="t33336R"   class="alignnone size-full wp-image-708" /></a><a href="http://byorgey.files.wordpress.com/2011/11/t33336l.png"><img src="http://byorgey.files.wordpress.com/2011/11/t33336l.png?w=450" alt="" title="t33336L"   class="alignnone size-full wp-image-707" /></a></p>
<p>The other question is how to represent tilings.  I chose to use this &#8220;zipper-like&#8221; representation:</p>
<pre><code>data Tiling = Tiling [TilingPoly] (Int -&gt; Tiling)</code></pre>
<p>Intuitively, a <code>Tiling</code> tells us what polygons surround the current vertex (ordered counterclockwise from the edge along which we entered the vertex), as well as what configurations we can reach by following edges out of the current vertex.  Thanks to laziness and knot-tying, we can easily define infinite tilings, such as</p>
<pre><code>
t4 :: Tiling
t4 = Tiling (replicate 4 Square) (const t4)
</code></pre>
<p>This is a particularly simple example, but the principle is the same.  You can <a href="https://patch-tag.com/r/byorgey/diagrams-contrib/snapshot/current/content/pretty/src/Diagrams/TwoD/Tilings.hs">look at the source</a> for more complex examples.</p>
<p><a href="http://byorgey.files.wordpress.com/2011/11/t31212.png"><img src="http://byorgey.files.wordpress.com/2011/11/t31212.png?w=450" alt="" title="t31212"   class="alignnone size-full wp-image-706" /></a><a href="http://byorgey.files.wordpress.com/2011/11/t4612.png"><img src="http://byorgey.files.wordpress.com/2011/11/t4612.png?w=450" alt="" title="t4612"   class="alignnone size-full wp-image-705" /></a><a href="http://byorgey.files.wordpress.com/2011/11/t3464.png"><img src="http://byorgey.files.wordpress.com/2011/11/t3464.png?w=450" alt="" title="t3464"   class="alignnone size-full wp-image-703" /></a><a href="http://byorgey.files.wordpress.com/2011/11/t6.png"><img src="http://byorgey.files.wordpress.com/2011/11/t6.png?w=450" alt="" title="t6"   class="alignnone size-full wp-image-701" /></a></p>
<p>Of course, this doesn&#8217;t really show off the capabilities of <code>diagrams</code> much (you can draw regular polygons with any old graphics library), but it sure was fun!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/byorgey.wordpress.com/697/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/byorgey.wordpress.com/697/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/byorgey.wordpress.com/697/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/byorgey.wordpress.com/697/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/byorgey.wordpress.com/697/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/byorgey.wordpress.com/697/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/byorgey.wordpress.com/697/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/byorgey.wordpress.com/697/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/byorgey.wordpress.com/697/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/byorgey.wordpress.com/697/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/byorgey.wordpress.com/697/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/byorgey.wordpress.com/697/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/byorgey.wordpress.com/697/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/byorgey.wordpress.com/697/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byorgey.wordpress.com&amp;blog=1152889&amp;post=697&amp;subd=byorgey&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://byorgey.wordpress.com/2011/11/12/generating-plane-tilings-with-diagrams/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<georss:point>39.953605 -75.213937</georss:point>
		<geo:lat>39.953605</geo:lat>
		<geo:long>-75.213937</geo:long>
		<media:content url="http://0.gravatar.com/avatar/cc113924265dbeb535c8b2fefe4e33ee?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Brent</media:title>
		</media:content>

		<media:content url="http://byorgey.files.wordpress.com/2011/11/t3.png" medium="image">
			<media:title type="html">t3</media:title>
		</media:content>

		<media:content url="http://byorgey.files.wordpress.com/2011/11/t4.png" medium="image">
			<media:title type="html">t4</media:title>
		</media:content>

		<media:content url="http://byorgey.files.wordpress.com/2011/11/t33434.png" medium="image">
			<media:title type="html">t33434</media:title>
		</media:content>

		<media:content url="http://byorgey.files.wordpress.com/2011/11/t3636.png" medium="image">
			<media:title type="html">t3636</media:title>
		</media:content>

		<media:content url="http://byorgey.files.wordpress.com/2011/11/t33344.png" medium="image">
			<media:title type="html">t33344</media:title>
		</media:content>

		<media:content url="http://byorgey.files.wordpress.com/2011/11/t488.png" medium="image">
			<media:title type="html">t488</media:title>
		</media:content>

		<media:content url="http://byorgey.files.wordpress.com/2011/11/t33336r.png" medium="image">
			<media:title type="html">t33336R</media:title>
		</media:content>

		<media:content url="http://byorgey.files.wordpress.com/2011/11/t33336l.png" medium="image">
			<media:title type="html">t33336L</media:title>
		</media:content>

		<media:content url="http://byorgey.files.wordpress.com/2011/11/t31212.png" medium="image">
			<media:title type="html">t31212</media:title>
		</media:content>

		<media:content url="http://byorgey.files.wordpress.com/2011/11/t4612.png" medium="image">
			<media:title type="html">t4612</media:title>
		</media:content>

		<media:content url="http://byorgey.files.wordpress.com/2011/11/t3464.png" medium="image">
			<media:title type="html">t3464</media:title>
		</media:content>

		<media:content url="http://byorgey.files.wordpress.com/2011/11/t6.png" medium="image">
			<media:title type="html">t6</media:title>
		</media:content>
	</item>
		<item>
		<title>Wanted GHC feature: warn about unused constraints</title>
		<link>http://byorgey.wordpress.com/2011/11/05/wanted-ghc-feature-warn-about-unused-constraints/</link>
		<comments>http://byorgey.wordpress.com/2011/11/05/wanted-ghc-feature-warn-about-unused-constraints/#comments</comments>
		<pubDate>Sun, 06 Nov 2011 01:03:52 +0000</pubDate>
		<dc:creator>Brent</dc:creator>
				<category><![CDATA[haskell]]></category>
		<category><![CDATA[constraints]]></category>
		<category><![CDATA[GHC]]></category>
		<category><![CDATA[unused]]></category>
		<category><![CDATA[warning]]></category>

		<guid isPermaLink="false">http://byorgey.wordpress.com/?p=692</guid>
		<description><![CDATA[Consider the following function: foo :: (Show a, Ord a) =&#62; a -&#62; a -&#62; String foo x y = show x ++ show y Currently (as of GHC 7.2.1) when compiling this code with -Wall, no warnings are generated. But I&#8217;d really love to get a warning like Foo.hs:1:1: Warning: Unused constraint: Ord a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byorgey.wordpress.com&amp;blog=1152889&amp;post=692&amp;subd=byorgey&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Consider the following function:</p>
<p><code>
<pre>
foo :: (Show a, Ord a) =&gt; a -&gt; a -&gt; String
foo x y = show x ++ show y
</pre>
<p></code></p>
<p>Currently (as of GHC 7.2.1) when compiling this code with <code>-Wall</code>, no warnings are generated.  But I&#8217;d really love to get a warning like</p>
<p><code>
<pre>
Foo.hs:1:1: Warning: Unused constraint: Ord a
</pre>
<p></code></p>
<p>I see no theoretical impediments here.  At the level of fully desugared and elaborated GHC core, it is no harder to tell which constraints are unused than which arguments are unused, because constraints <i>are</i> arguments.</p>
<p>One possible objection is that there is some inherent ambiguity here.  For example, consider:</p>
<p><code>
<pre>
bar :: (Eq a, Ord a) =&gt; a -&gt; a -&gt; String
bar x y | x == y    = "yay"
        | otherwise = "boo"
</pre>
<p></code></p>
<p>When elaborating <code>bar</code>, GHC has a free choice of where to get the needed <code>(==)</code> method: from the <code>Eq</code> constraint or from the <code>Eq</code> superclass of the <code>Ord</code> constraint.  So we might get a warning about <code>Eq</code> being redundant or about <code>Ord</code> being redundant, depending on which one it decides to use.  But I don&#8217;t see this as a big problem.</p>
<p>I think this could make for a nice project for someone wanting to dig into hacking on GHC.  Perhaps I&#8217;ll do it myself at some point if no one else takes it on.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/byorgey.wordpress.com/692/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/byorgey.wordpress.com/692/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/byorgey.wordpress.com/692/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/byorgey.wordpress.com/692/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/byorgey.wordpress.com/692/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/byorgey.wordpress.com/692/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/byorgey.wordpress.com/692/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/byorgey.wordpress.com/692/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/byorgey.wordpress.com/692/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/byorgey.wordpress.com/692/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/byorgey.wordpress.com/692/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/byorgey.wordpress.com/692/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/byorgey.wordpress.com/692/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/byorgey.wordpress.com/692/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byorgey.wordpress.com&amp;blog=1152889&amp;post=692&amp;subd=byorgey&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://byorgey.wordpress.com/2011/11/05/wanted-ghc-feature-warn-about-unused-constraints/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<georss:point>39.953605 -75.213937</georss:point>
		<geo:lat>39.953605</geo:lat>
		<geo:long>-75.213937</geo:long>
		<media:content url="http://0.gravatar.com/avatar/cc113924265dbeb535c8b2fefe4e33ee?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Brent</media:title>
		</media:content>
	</item>
		<item>
		<title>More counting lambda terms</title>
		<link>http://byorgey.wordpress.com/2011/10/24/more-counting-lambda-terms/</link>
		<comments>http://byorgey.wordpress.com/2011/10/24/more-counting-lambda-terms/#comments</comments>
		<pubDate>Mon, 24 Oct 2011 21:33:00 +0000</pubDate>
		<dc:creator>Brent</dc:creator>
				<category><![CDATA[haskell]]></category>

		<guid isPermaLink="false">http://byorgey.wordpress.com/?p=689</guid>
		<description><![CDATA[Yesterday someone submitted a comment to an old post of mine about counting linear lambda terms, asking the following question: I am interested in a similar problem: given a natural number N, what is the number of different symply-typed closed lambda terms with size smaller than N? They don&#8217;t need to be observationally different. They [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byorgey.wordpress.com&amp;blog=1152889&amp;post=689&amp;subd=byorgey&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Yesterday someone <a href="http://byorgey.wordpress.com/2011/01/26/counting-linear-lambda-terms/#comment-8575">submitted a comment</a> to an old post of mine about counting linear lambda terms, asking the following question:</p>
<blockquote><p>I am interested in a similar problem: given a natural number N, what is the number of different symply-typed closed lambda terms with size smaller than N?</p>
<p>They don&#8217;t need to be observationally different. They should be different modulo renaming of variables and types, though. So:</p>
<p>lambda x^A.x and lambda y^B.y</p>
<p>should be considered the same&#8230;</p>
<p>Do you know where I can find the answer? Answers using any kind of size measurement would be fine for me&#8230;</p></blockquote>
<p>It&#8217;s an interesting question, and I thought it would make for a good way to illustrate one of my favorite techniques when trying to research a combinatorial question like this. Namely, write a program to compute the first few values by brute force, then look it up in the <a href="http://oeis.org">Online Encyclopedia of Integer Sequences</a> and follow the references.</p>
<p>Let&#8217;s start with <em>untyped</em> lambda calculus terms.</p>
<pre><code><span>&gt;</span> <span style="color:blue;font-weight:bold;">module</span> <span>CountSTLC</span> <span style="color:blue;font-weight:bold;">where</span>
<span>&gt;</span>
<span>&gt;</span> <span style="color:blue;font-weight:bold;">type</span> <span>Nat</span> <span style="color:red;">=</span> <span>Int</span>  <span style="color:green;">-- just pretend</span>
</code></pre>
<p>A type for deBruijn-indexed lambda terms.</p>
<pre><code><span>&gt;</span> <span style="color:blue;font-weight:bold;">data</span> <span>Tm</span> <span style="color:red;">=</span> <span>Var</span> <span>Nat</span>
<span>&gt;</span>         <span style="color:red;">|</span> <span>App</span> <span>Tm</span> <span>Tm</span>
<span>&gt;</span>         <span style="color:red;">|</span> <span>Lam</span> <span>Tm</span>
<span>&gt;</span>   <span style="color:blue;font-weight:bold;">deriving</span> <span style="color:red;">(</span><span>Eq</span><span style="color:red;">,</span> <span>Ord</span><span style="color:red;">,</span> <span>Show</span><span style="color:red;">)</span>
</code></pre>
<p>We&#8217;ll define the <em>size</em> of a term as the number of constructors used by its representation in the above data type.</p>
<pre><code><span>&gt;</span> <span>size</span> <span style="color:red;">::</span> <span>Tm</span> <span style="color:red;">-&gt;</span> <span>Nat</span>
<span>&gt;</span> <span>size</span> <span style="color:red;">(</span><span>Var</span> <span style="color:blue;font-weight:bold;">_</span><span style="color:red;">)</span>     <span style="color:red;">=</span> <span class="hs-num">1</span>
<span>&gt;</span> <span>size</span> <span style="color:red;">(</span><span>App</span> <span>t1</span> <span>t2</span><span style="color:red;">)</span> <span style="color:red;">=</span> <span class="hs-num">1</span> <span>+</span> <span>size</span> <span>t1</span> <span>+</span> <span>size</span> <span>t2</span>
<span>&gt;</span> <span>size</span> <span style="color:red;">(</span><span>Lam</span> <span>t</span><span style="color:red;">)</span>     <span style="color:red;">=</span> <span class="hs-num">1</span> <span>+</span> <span>size</span> <span>t</span>
</code></pre>
<p>Here&#8217;s a function to generate all the closed <code>Tm</code>s of a given size. We pass along an index giving the current level of nesting (so we know what variables are available).</p>
<pre><code><span>&gt;</span> <span>genAll</span> <span style="color:red;">::</span> <span>Nat</span> <span style="color:red;">-&gt;</span> <span style="color:red;">[</span><span>Tm</span><span style="color:red;">]</span>
<span>&gt;</span> <span>genAll</span> <span style="color:red;">=</span> <span>genAll'</span> <span class="hs-num">0</span>
<span>&gt;</span>   <span style="color:blue;font-weight:bold;">where</span>
</code></pre>
<p>There are no terms of size zero (or smaller).</p>
<pre><code><span>&gt;</span>     <span>genAll'</span> <span style="color:blue;font-weight:bold;">_</span>   <span>n</span> <span style="color:red;">|</span> <span>n</span> <span>&lt;=</span> <span class="hs-num">0</span> <span style="color:red;">=</span> <span>[]</span>
</code></pre>
<p>The only terms of size 1 are variables. We can choose to refer to any of the currently enclosing lambdas.</p>
<pre><code><span>&gt;</span>     <span>genAll'</span> <span>ctx</span> <span class="hs-num">1</span> <span style="color:red;">=</span> <span>map</span> <span>Var</span> <span style="color:red;">[</span><span class="hs-num">0</span> <span style="color:red;">..</span> <span>ctx</span><span style="color:green;">-</span><span class="hs-num">1</span><span style="color:red;">]</span>
</code></pre>
<p>Otherwise, we could have an application (splitting the available size between the two sides in all possible ways) or a lambda (remembering to increment the nesting level).</p>
<pre><code><span>&gt;</span>     <span>genAll'</span> <span>ctx</span> <span>n</span> <span style="color:red;">=</span> <span style="color:red;">[</span> <span>App</span> <span>t1</span> <span>t2</span>
<span>&gt;</span>                     <span style="color:red;">|</span> <span>n1</span> <span style="color:red;">&lt;-</span> <span style="color:red;">[</span><span class="hs-num">1</span> <span style="color:red;">..</span> <span>n</span><span style="color:green;">-</span><span class="hs-num">2</span><span style="color:red;">]</span>
<span>&gt;</span>                     <span style="color:red;">,</span> <span>t1</span> <span style="color:red;">&lt;-</span> <span>genAll'</span> <span>ctx</span> <span>n1</span>
<span>&gt;</span>                     <span style="color:red;">,</span> <span>t2</span> <span style="color:red;">&lt;-</span> <span>genAll'</span> <span>ctx</span> <span style="color:red;">(</span><span>n</span> <span style="color:green;">-</span> <span>n1</span> <span style="color:green;">-</span> <span class="hs-num">1</span><span style="color:red;">)</span>
<span>&gt;</span>                     <span style="color:red;">]</span>
<span>&gt;</span>                  <span>++</span> <span style="color:red;">(</span><span>map</span> <span>Lam</span> <span style="color:red;">(</span><span>genAll'</span> <span style="color:red;">(</span><span>succ</span> <span>ctx</span><span style="color:red;">)</span> <span style="color:red;">(</span><span>n</span><span style="color:green;">-</span><span class="hs-num">1</span><span style="color:red;">)</span><span style="color:red;">)</span><span style="color:red;">)</span>
</code></pre>
<p>Let&#8217;s see what we get:</p>
<pre><code>*CountSTLC&gt; genAll 4
[ Lam (App (Var 0) (Var 0))
, Lam (Lam (Lam (Var 0)))
, Lam (Lam (Lam (Var 1)))
, Lam (Lam (Lam (Var 2)))
]</code></pre>
<p>Looks reasonable: there are four closed lambda terms of size 4. Now let&#8217;s count:</p>
<pre><code>*CountSTLC&gt; map (length . genAll) [1..10]
[0,1,2,4,13,42,139,506,1915,7558]</code></pre>
<p>Searching for this sequence on OEIS turns up <a href="http://oeis.org/A135501">something promising</a>, with a bit of information including a formula for computing the counts directly. It also has a link to someone&#8217;s research but unfortunately it seems dead. But it does have the email address of the person who submitted this sequence, and emailing him might be a good start!</p>
<p>This is all well and good, but the commenter actually asked for <em>simply typed</em> lambda calculus terms. The first size-4 lambda term above is not well-typed, since it involves a self-application. Can we modify our program to only generate well-typed lambda terms? This seems much more difficult. I may write about it in a future post. For now I&#8217;ll leave it as an exercise for the interested and motivated reader!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/byorgey.wordpress.com/689/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/byorgey.wordpress.com/689/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/byorgey.wordpress.com/689/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/byorgey.wordpress.com/689/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/byorgey.wordpress.com/689/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/byorgey.wordpress.com/689/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/byorgey.wordpress.com/689/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/byorgey.wordpress.com/689/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/byorgey.wordpress.com/689/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/byorgey.wordpress.com/689/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/byorgey.wordpress.com/689/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/byorgey.wordpress.com/689/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/byorgey.wordpress.com/689/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/byorgey.wordpress.com/689/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byorgey.wordpress.com&amp;blog=1152889&amp;post=689&amp;subd=byorgey&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://byorgey.wordpress.com/2011/10/24/more-counting-lambda-terms/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/cc113924265dbeb535c8b2fefe4e33ee?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Brent</media:title>
		</media:content>
	</item>
		<item>
		<title>Announcing diagrams-0.4</title>
		<link>http://byorgey.wordpress.com/2011/10/23/announcing-diagrams-0-4/</link>
		<comments>http://byorgey.wordpress.com/2011/10/23/announcing-diagrams-0-4/#comments</comments>
		<pubDate>Sun, 23 Oct 2011 18:47:24 +0000</pubDate>
		<dc:creator>Brent</dc:creator>
				<category><![CDATA[haskell]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[diagrams]]></category>
		<category><![CDATA[drawing]]></category>
		<category><![CDATA[EDSL]]></category>
		<category><![CDATA[release]]></category>

		<guid isPermaLink="false">http://byorgey.wordpress.com/?p=681</guid>
		<description><![CDATA[I am pleased to announce the release of version 0.4 of diagrams, a full-featured framework and embedded domain-specific language for declarative drawing. The last announcement was of the 0.1 release; there have been quite a few changes and improvements since then, including: A new website including a gallery of examples A new comprehensive user manual [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byorgey.wordpress.com&amp;blog=1152889&amp;post=681&amp;subd=byorgey&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I am pleased to announce the release of version 0.4 of <a href="http://projects.haskell.org/diagrams">diagrams</a>, a full-featured framework and embedded domain-specific language for declarative drawing.</p>
<p>The last announcement was of the 0.1 release; there have been quite a few changes and improvements since then, including:</p>
<ul>
<li>A new <a href="http://projects.haskell.org/diagrams">website</a> including a <a href="http://projects.haskell.org/diagrams/gallery.html">gallery</a> of examples</li>
<li>A new comprehensive <a href="http://projects.haskell.org/diagrams/manual/diagrams-manual.html">user manual</a> with lots of illustrative examples</li>
<li>New primitive shapes: rounded rectangles, wedges, and a new flexible API for generating polygons</li>
<li>Cubic splines</li>
<li>Basic text support</li>
<li>Support for external image primitives</li>
<li>Lots more convenient combinators, bug fixes, and improvements</li>
</ul>
<h2 id="cool-how-can-i-try-it-out">Cool, how can I try it out?</h2>
<p>For the truly impatient:</p>
<pre><code>cabal install gtk2hs-buildtools
cabal install diagrams
</code></pre>
<p>For the slightly less impatient, read the <a href="http://projects.haskell.org/diagrams/tutorial/DiagramsTutorial.html">quick tutorial</a>, which has detailed information about how to install the necessary packages and will introduce you to the fundamentals of the framework.</p>
<p>For those who are even less impatient but want to really dig in and use the power features, read the <a href="http://projects.haskell.org/manual/diagrams-manual.html">user manual</a>.</p>
<h2 id="cool-how-can-i-contribute">Cool, how can I contribute?</h2>
<p>There are lots of ways you can contribute! First, you may want to subscribe to the <a href="http://groups.google.com/group/diagrams-discuss">project mailing list</a>, and/or come hang out in the <code>#diagrams</code> IRC channel on freenode.org.</p>
<ul>
<li>There are lots of easy bug fixes, improvements, and feature requests just waiting for people wanting to get involved: see the <a href="http://code.google.com/p/diagrams/issues/list">bug tracker</a> for a list of open tickets.
<p>The source repositories are mirrored using both darcs (on patch-tag.com) and git (on github.com), and patches are accepted in either place, thanks to Owen Stephen&#8217;s great work on <a href="http://wiki.darcs.net/DarcsBridgeUsage">darcs-bridge</a>.</p>
</li>
<li>Create a higher-level module built on top of the diagrams framework (e.g. tree or graph layout, generating Turing machine configuration diagrams, Penrose tilings &#8230; your imagination is the only limit!) and submit it for inclusion in a special diagrams-contrib package which will be created for such higher-level user-contributed modules.</li>
<li>Use diagrams to create some cool graphics and submit them for inclusion in the <a href="http://projects.haskell.org/diagrams/gallery.html">gallery</a>.</li>
<li>Start your own project built on top of diagrams and let us know how it goes!</li>
<li>Last but certainly not least, just try it out for your pet graphics generation needs and contribute your bug reports and feature requests.</li>
</ul>
<p>Happy diagramming!</p>
<p>Brought to you by the diagrams team:</p>
<ul>
<li>Brent Yorgey</li>
<li>Ryan Yates</li>
</ul>
<p>with contributions from:</p>
<ul>
<li>Sam Griffin</li>
<li>Claude Heiland-Allen</li>
<li>John Lato</li>
<li>Vilhelm Sjöberg</li>
<li>Luite Stegeman</li>
<li>Kanchalai Suveepattananont</li>
<li>Scott Walck</li>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/byorgey.wordpress.com/681/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/byorgey.wordpress.com/681/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/byorgey.wordpress.com/681/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/byorgey.wordpress.com/681/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/byorgey.wordpress.com/681/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/byorgey.wordpress.com/681/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/byorgey.wordpress.com/681/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/byorgey.wordpress.com/681/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/byorgey.wordpress.com/681/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/byorgey.wordpress.com/681/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/byorgey.wordpress.com/681/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/byorgey.wordpress.com/681/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/byorgey.wordpress.com/681/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/byorgey.wordpress.com/681/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byorgey.wordpress.com&amp;blog=1152889&amp;post=681&amp;subd=byorgey&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://byorgey.wordpress.com/2011/10/23/announcing-diagrams-0-4/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<georss:point>39.953605 -75.213937</georss:point>
		<geo:lat>39.953605</geo:lat>
		<geo:long>-75.213937</geo:long>
		<media:content url="http://0.gravatar.com/avatar/cc113924265dbeb535c8b2fefe4e33ee?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Brent</media:title>
		</media:content>
	</item>
		<item>
		<title>Effective parse tree support for the working semanticist</title>
		<link>http://byorgey.wordpress.com/2011/10/11/effective-parse-tree-support-for-the-working-semanticist/</link>
		<comments>http://byorgey.wordpress.com/2011/10/11/effective-parse-tree-support-for-the-working-semanticist/#comments</comments>
		<pubDate>Tue, 11 Oct 2011 19:04:25 +0000</pubDate>
		<dc:creator>Brent</dc:creator>
				<category><![CDATA[haskell]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[ambiguous]]></category>
		<category><![CDATA[grammar]]></category>
		<category><![CDATA[Ott]]></category>
		<category><![CDATA[parse]]></category>
		<category><![CDATA[pretty]]></category>
		<category><![CDATA[tree]]></category>

		<guid isPermaLink="false">http://byorgey.wordpress.com/?p=674</guid>
		<description><![CDATA[If, like me, you spend large amounts of time designing, discussing, and proving things about programming languages and formal calculi, chances are you have used Ott (and if you do, but you haven&#8217;t, you are really missing out). You write down a formal system once, in a special format that Ott understands, and Ott typechecks [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byorgey.wordpress.com&amp;blog=1152889&amp;post=674&amp;subd=byorgey&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If, like me, you spend large amounts of time designing, discussing, and proving things about programming languages and formal calculi, chances are you have used <a href="http://www.cl.cam.ac.uk/~pes20/ott/" title="Ott">Ott</a> (and if you do, but you haven&#8217;t, you are really missing out).  You write down a formal system once, in a special format that Ott understands, and Ott typechecks it and can automatically generate nice LaTeX as well as code for proof assistants like Coq or Isabelle.</p>
<p>However, anyone who has worked with Ott is familiar with is the dreaded ambiguous parse error.  Quite often Ott grammars end up being ambiguous, and Ott needs some guidance to know which parse you want.  However, the error messages are horrendous: Ott spews forth several massive parse trees in a format requiring formidable patience to read.  Finding the slight differences between two such parse trees is an exercise in seizure-inducing tedium.</p>
<p>I got sick of this so I wrote a little tool to help, which is now available on Hackage: <a href="http://hackage.haskell.org/package/ottparse%2Dpretty" title="ottparse-pretty">ottparse-pretty</a>.  You paste in an Ott parse tree and it shows it to you in a nicely formatted tree view with a bunch of useless cruft removed.  For example, it turns this:</p>
<p><code><br />
(St_node :formula:formula_judgement: (Ste_st (St_node :judgement:judgement_Jtype: (Ste_st<br />
(St_node :Jtype:coerce: (Ste_st (St_nonterm G)) (Ste_st (St_nonterm g)) (Ste_st (St_node<br />
:s:T_MultiTypeApp: (Ste_st (St_node :s:T_EqTy: (Ste_st (St_node :s:T_MultiTypeApp: (Ste_st<br />
(St_node :s:T_MultiKindApp: (Ste_st (St_node :s:T_Cons: (Ste_st (St_nonterm H)))) (Ste_st<br />
(St_nonterm k)))) (Ste_st (St_nonterm t)))) (Ste_st (St_node :s:T_MultiKindApp: (Ste_st<br />
(St_node :s:T_Cons: (Ste_st (St_nonterm H)))) (Ste_st (St_nonterm k)))))) (Ste_st (St_nonterm<br />
t')))))))))<br />
</code></p>
<p>into this:</p>
<p><code>
<pre>
formula_judgement
|
`- judgement_Jtype
   |
   `- coerce
      |
      +- G
      |
      +- g
      |
      `- T_MultiTypeApp
         |
         +- T_EqTy
         |  |
         |  +- T_MultiTypeApp
         |  |  |
         |  |  +- T_MultiKindApp
         |  |  |  |
         |  |  |  +- T_Cons
         |  |  |  |  |
         |  |  |  |  `- H
         |  |  |  |
         |  |  |  `- k
         |  |  |
         |  |  `- t
         |  |
         |  `- T_MultiKindApp
         |     |
         |     +- T_Cons
         |     |  |
         |     |  `- H
         |     |
         |     `- k
         |
         `- t'
</pre>
<p></code></p>
<p>It&#8217;s pretty simplistic at the moment&#8212;I may add more features depending on feedback.  But it&#8217;s been useful for me so it seemed worth packaging it up in case it&#8217;s useful to anyone else.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/byorgey.wordpress.com/674/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/byorgey.wordpress.com/674/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/byorgey.wordpress.com/674/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/byorgey.wordpress.com/674/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/byorgey.wordpress.com/674/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/byorgey.wordpress.com/674/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/byorgey.wordpress.com/674/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/byorgey.wordpress.com/674/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/byorgey.wordpress.com/674/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/byorgey.wordpress.com/674/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/byorgey.wordpress.com/674/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/byorgey.wordpress.com/674/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/byorgey.wordpress.com/674/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/byorgey.wordpress.com/674/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byorgey.wordpress.com&amp;blog=1152889&amp;post=674&amp;subd=byorgey&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://byorgey.wordpress.com/2011/10/11/effective-parse-tree-support-for-the-working-semanticist/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<georss:point>39.953605 -75.213937</georss:point>
		<geo:lat>39.953605</geo:lat>
		<geo:long>-75.213937</geo:long>
		<media:content url="http://0.gravatar.com/avatar/cc113924265dbeb535c8b2fefe4e33ee?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Brent</media:title>
		</media:content>
	</item>
		<item>
		<title>diagrams repos now mirrored on github!</title>
		<link>http://byorgey.wordpress.com/2011/09/10/diagrams-repos-now-mirrored-on-github/</link>
		<comments>http://byorgey.wordpress.com/2011/09/10/diagrams-repos-now-mirrored-on-github/#comments</comments>
		<pubDate>Sun, 11 Sep 2011 00:26:45 +0000</pubDate>
		<dc:creator>Brent</dc:creator>
				<category><![CDATA[haskell]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[bridge]]></category>
		<category><![CDATA[darcs]]></category>
		<category><![CDATA[diagrams]]></category>
		<category><![CDATA[git]]></category>

		<guid isPermaLink="false">http://byorgey.wordpress.com/?p=668</guid>
		<description><![CDATA[I was quite excited when I learned that Owen Stephens was working on a two-way darcs-git bridge for his Google Summer of Code project. You see, I&#8217;m one of those holdouts who, despite acknowledging that github is pretty cool and a lot of people in the Haskell community are using it these days, still really [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byorgey.wordpress.com&amp;blog=1152889&amp;post=668&amp;subd=byorgey&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I was quite excited when I learned that <a href="http://www.owenstephens.co.uk/" title="Owen Stephens">Owen Stephens</a> was working on a two-way darcs-git bridge for his Google Summer of Code project.  You see, I&#8217;m one of those holdouts who, despite acknowledging that <a href="http://github.com" title="GitHub">github</a> is pretty cool and a lot of people in the Haskell community are using it these days, still really loves <a href="http://darcs.net" title="darcs">darcs</a> and refuses to give it up.  Well, thanks to <a href="http://blog.owenstephens.co.uk/201109/gsoc-darcs-bridge-%E2%80%93-results" title="GSoC: Darcs Bridge - Results">Owen&#8217;s great work</a>, it looks like I can now have my cake and eat it too.</p>
<p>I&#8217;ve now mirrored four <a href="http://projects.haskell.org/diagrams" title="diagrams">diagrams</a> repositories on github:</p>
<ul>
<li><a href="https://github.com/byorgey/diagrams-core" title="diagrams-core">diagrams-core</a> &#8211; core library</li>
<li><a href="https://github.com/byorgey/diagrams-lib" title="diagrams-lib">diagrams-lib</a> &#8211; standard library of primitives and combinators built on top of diagrams-core</li>
<li><a href="https://github.com/byorgey/diagrams-cairo" title="diagrams-cairo">diagrams-cairo</a> &#8211; rendering backend using cairo</li>
<li><a href="https://github.com/byorgey/diagrams-doc" title="diagrams-doc">diagrams-doc</a> &#8211; documentation for the project, including source code for the <a href="http://projects.haskell.org/diagrams" title="Diagrams">website</a>, tutorial, user manual, IRC logs, etc.</li>
</ul>
<p>I will continue to use darcs as my primary VCS, and of course I will still accept darcs patches (the darcs repos are <a href="http://patch-tag.com/r/byorgey/">hosted on patch-tag.com</a>).  But I can now accept pull requests on github, for contributors who prefer using git/github.  It will probably take a while to get the kinks worked out and figure out how to manage everything properly.  But I&#8217;m excited by the opportunity to encourage more collaboration.</p>
<p>Oh yes, and the user manual is coming along nicely!  You can see a <a href="http://www.cis.upenn.edu/~byorgey/diagrams-manual/diagrams-manual.html" title="Diagrams user manual (preview)">preview version here</a>.  Comments and patches (via either darcs or git!) welcome.  There have also been quite a few cool features added since the 0.3 release, and we hope to have an 0.4 release out soon.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/byorgey.wordpress.com/668/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/byorgey.wordpress.com/668/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/byorgey.wordpress.com/668/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/byorgey.wordpress.com/668/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/byorgey.wordpress.com/668/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/byorgey.wordpress.com/668/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/byorgey.wordpress.com/668/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/byorgey.wordpress.com/668/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/byorgey.wordpress.com/668/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/byorgey.wordpress.com/668/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/byorgey.wordpress.com/668/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/byorgey.wordpress.com/668/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/byorgey.wordpress.com/668/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/byorgey.wordpress.com/668/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byorgey.wordpress.com&amp;blog=1152889&amp;post=668&amp;subd=byorgey&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://byorgey.wordpress.com/2011/09/10/diagrams-repos-now-mirrored-on-github/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<georss:point>39.953605 -75.213937</georss:point>
		<geo:lat>39.953605</geo:lat>
		<geo:long>-75.213937</geo:long>
		<media:content url="http://0.gravatar.com/avatar/cc113924265dbeb535c8b2fefe4e33ee?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Brent</media:title>
		</media:content>
	</item>
		<item>
		<title>Math.Tau</title>
		<link>http://byorgey.wordpress.com/2011/09/09/math-tau/</link>
		<comments>http://byorgey.wordpress.com/2011/09/09/math-tau/#comments</comments>
		<pubDate>Fri, 09 Sep 2011 20:07:29 +0000</pubDate>
		<dc:creator>Brent</dc:creator>
				<category><![CDATA[haskell]]></category>
		<category><![CDATA[announcement]]></category>
		<category><![CDATA[Hackage]]></category>
		<category><![CDATA[tau]]></category>

		<guid isPermaLink="false">http://byorgey.wordpress.com/?p=664</guid>
		<description><![CDATA[I have just uploaded a new package to Hackage which defines the constant . Now if you wish to use in your program you can just cabal install tau and then import Math.Tau (tau), and be assured that you are using only the highest-quality definition of this fundamentally important constant.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byorgey.wordpress.com&amp;blog=1152889&amp;post=664&amp;subd=byorgey&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I have just uploaded <a href="http://hackage.haskell.org/package/tau" title="The tau package">a new package</a> to Hackage which defines the <a href="http://tauday.com">constant <img src='http://s0.wp.com/latex.php?latex=%5Ctau&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;tau' title='&#92;tau' class='latex' /></a>.  Now if you wish to use <img src='http://s0.wp.com/latex.php?latex=%5Ctau&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;tau' title='&#92;tau' class='latex' /> in your program you can just <code>cabal install tau</code> and then <code>import Math.Tau (tau)</code>, and be assured that you are using only the highest-quality definition of this fundamentally important constant.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/byorgey.wordpress.com/664/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/byorgey.wordpress.com/664/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/byorgey.wordpress.com/664/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/byorgey.wordpress.com/664/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/byorgey.wordpress.com/664/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/byorgey.wordpress.com/664/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/byorgey.wordpress.com/664/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/byorgey.wordpress.com/664/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/byorgey.wordpress.com/664/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/byorgey.wordpress.com/664/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/byorgey.wordpress.com/664/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/byorgey.wordpress.com/664/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/byorgey.wordpress.com/664/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/byorgey.wordpress.com/664/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byorgey.wordpress.com&amp;blog=1152889&amp;post=664&amp;subd=byorgey&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://byorgey.wordpress.com/2011/09/09/math-tau/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<georss:point>39.953605 -75.213937</georss:point>
		<geo:lat>39.953605</geo:lat>
		<geo:long>-75.213937</geo:long>
		<media:content url="http://0.gravatar.com/avatar/cc113924265dbeb535c8b2fefe4e33ee?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Brent</media:title>
		</media:content>
	</item>
	</channel>
</rss>
