<?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: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>Wed, 28 Oct 2009 18:59:03 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='byorgey.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/af1709898531c0e138ff43d109695663?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>blog :: Brent -&#62; [String]</title>
		<link>http://byorgey.wordpress.com</link>
	</image>
			<item>
		<title>Collecting attributes</title>
		<link>http://byorgey.wordpress.com/2009/10/28/collecting-attributes/</link>
		<comments>http://byorgey.wordpress.com/2009/10/28/collecting-attributes/#comments</comments>
		<pubDate>Wed, 28 Oct 2009 18:59:03 +0000</pubDate>
		<dc:creator>Brent</dc:creator>
				<category><![CDATA[haskell]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[attributes]]></category>
		<category><![CDATA[diagrams]]></category>
		<category><![CDATA[monoid]]></category>
		<category><![CDATA[overriding]]></category>
		<category><![CDATA[priority]]></category>

		<guid isPermaLink="false">http://byorgey.wordpress.com/?p=319</guid>
		<description><![CDATA[I&#8217;m proceeding with the redesign of my diagrams library slowly but surely.  I don&#8217;t have a lot of time to work on it, hence the &#8220;slowly&#8221;.  But progress is being made.  It&#8217;s still very much in the design phase, which makes it difficult for others to help, but Lennart has created a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byorgey.wordpress.com&blog=1152889&post=319&subd=byorgey&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I&#8217;m proceeding with the <a href="http://byorgey.wordpress.com/2009/09/24/diagrams-0-2-1-and-future-plans/">redesign of my diagrams library</a> slowly but surely.  I don&#8217;t have a lot of time to work on it, hence the &#8220;slowly&#8221;.  But progress is being made.  It&#8217;s still very much in the design phase, which makes it difficult for others to help, but <a href="http://www.haskell.org/haskellwiki/User:Lenny222">Lennart</a> has created a <a href="http://www.haskell.org/haskellwiki/Diagrams">diagrams page</a> on the Haskell wiki which I hope can be a good way to have an open design process and get input from the community.  There&#8217;s a lot of stuff I have written down that I haven&#8217;t gotten around to putting on that page yet, but I hope to do that soon.</p>
<p>Occasionally I plan to write some blog posts about interesting issues that arise in the design; today is the first.</p>
<p>Here&#8217;s the background: a diagram is essentially a tree of sub-diagrams (although there will be a principled way to refer to subdiagrams in other parts of the tree; more on this in a future post), with leaves corresponding to atomic primitives.  Every node in the tree can (optionally) have some associated style attributes, such as stroke width and color, fill color, font, and other such things.  When we encounter a primitive at a leaf, how do we know what attributes to use when rendering it?  It may have some associated attributes, but its parent node might also have some associated attributes, and other ancestor nodes higher up the tree might have attributes as well.</p>
<p>What we&#8217;d really like to do is have a <code>Style</code> data type which has a <code>Monoid</code> instance:</p>
<pre>
data Style = Style { strokeWidth :: Double
                   , strokeColour :: Colour
                   ... }

instance Monoid Style where
  ...
</pre>
<p>Then to determine the style to use for a leaf, we just combine the styles of all its ancestors using the monoid.</p>
<p>So, how to implement this <code>Monoid</code> instance?  Well, first of all, what I wrote above is slightly bogus; at the very least each particular attribute ought to be optional, so it should look something more like this:</p>
<pre>
data Style = Style { strokeWidth :: Maybe Double
                   , strokeColour :: Maybe Colour
                   ... }
</pre>
<p>To combine two <code>Style</code> records, we match them up field-by-field, and <code>Just</code> trumps <code>Nothing</code>.  </p>
<p>So far, so good.  But how do we combine two fields containing <code>Just</code>?  It seems we have two choices: we can be biased towards the top of the tree (i.e. parent attributes override child attributes) or towards the bottom (i.e. child attributes override parent attributes).  Indeed, <code>Data.Monoid</code> contains two newtypes, <code>First</code> and <code>Last</code>, whose <code>Monoid</code> instances exhibit exactly this behavior.</p>
<p>But here&#8217;s the problem: in this application, one of these choices isn&#8217;t obviously better than the other.  In fact, it&#8217;s easy to imagine situations where each would be the desired behavior.  For example, imagine that we have created a subdiagram that we want to use many times throughout a larger diagram.  Most of the time it will be blue, so it makes sense to specify that attribute as part of the subdiagram itself.  However, in one place we want it to be red, so we&#8217;d like to be able to override its attributes with parent attributes.  On the other hand, imagine a situation where a diagram is going to be composed of many different subdiagrams, which all share the property that they are blue.  To avoid repeating ourselves, it makes sense to specify &#8220;blueness&#8221; as an attribute of the parent diagram and have all the subdiagrams inherit it.  However, one subdiagram should be red, so we&#8217;d like to be able to override the parent attribute in this particular child.</p>
<p>What to do?  A first cut might look something like this:</p>
<pre>
data Override a = Default | OverrideUp a | OverrideDown a

data Style = Style { strokeWidth :: Override Double
                   , strokeColour :: Override Colour
                   ... }
</pre>
<p>The intention is that <code>OverrideUp a</code> overrides any attributes above/before it, and <code>OverrideDown a</code> overrides any attributes below/after it.  However, there&#8217;s a problem: what should</p>
<p><code>(OverrideDown a) `mappend` (OverrideUp b)</code></p>
<p>be?  The <code>OverrideDown a</code> claims to override the <code>OverrideUp b</code>&#8230; and vice versa!  So this doesn&#8217;t really work.  We need a way to specify relative priorities.  So, another solution would just be to assign each attribute with a priority:</p>
<pre>
data Prioritized a = Default | Priority Double a

data Style = Style { strokeWidth :: Prioritized Double
                   , strokeColour :: Prioritized Colour
                   ... }
</pre>
<p>For the <code>Monoid</code> instance, we just take the value with maximum priority.  This allows us to do what we wanted&#8212;overriding parent or child attributes is done simply by assigning a higher priority.  However, I <i>really</i> dislike this solution.  Having to specify a priority is annoying&#8212;but not only that, figuring out what priority to use to achieve your desired effect requires global knowledge about the value of the priorities used elsewhere.  One improvement we could make is to adopt the solution used by CSS: attributes are leaf-biased by default, but assigning a priority can override this.  That is,</p>
<pre>
data Prioritized a = Default | Priority (Maybe Double) a
</pre>
<p>where the <code>Monoid</code> instance chooses the value with the highest priority, or the right/leaf-most value if no priorities are specified.  This might be the best option&#8212;but it&#8217;s still somewhat unsatisfactory.</p>
<p>I wonder about a solution that allows you to say, &#8220;I want to override the attribute on THAT node&#8221;&#8212;where &#8220;THAT&#8221; represents some way to refer to a particular node by name (what these names look like will be the subject of another post).  This might solve the problem of arbitrariness with the numerical priorities, but might also be veering into the realm of the overengineered&#8230;</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/byorgey.wordpress.com/319/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/byorgey.wordpress.com/319/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/byorgey.wordpress.com/319/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/byorgey.wordpress.com/319/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/byorgey.wordpress.com/319/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/byorgey.wordpress.com/319/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/byorgey.wordpress.com/319/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/byorgey.wordpress.com/319/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/byorgey.wordpress.com/319/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/byorgey.wordpress.com/319/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byorgey.wordpress.com&blog=1152889&post=319&subd=byorgey&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://byorgey.wordpress.com/2009/10/28/collecting-attributes/feed/</wfw:commentRss>
		<slash:comments>25</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 in Japanese!</title>
		<link>http://byorgey.wordpress.com/2009/10/20/typeclassopedia-in-japanese/</link>
		<comments>http://byorgey.wordpress.com/2009/10/20/typeclassopedia-in-japanese/#comments</comments>
		<pubDate>Tue, 20 Oct 2009 14:51:16 +0000</pubDate>
		<dc:creator>Brent</dc:creator>
				<category><![CDATA[links]]></category>
		<category><![CDATA[haskell]]></category>
		<category><![CDATA[Japanese]]></category>
		<category><![CDATA[translation]]></category>
		<category><![CDATA[Typeclassopedia]]></category>

		<guid isPermaLink="false">http://byorgey.wordpress.com/?p=315</guid>
		<description><![CDATA[Satoshi Nakamura has published a Japanese translation of the Typeclassopedia.  I don&#8217;t read any Japanese, but it sure looks cool, and I hope this will be a great resource for Japanese learners of Haskell.  A big thank you to Satoshi for his hard work; the Typeclassopedia is certainly not short!
    [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byorgey.wordpress.com&blog=1152889&post=315&subd=byorgey&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Satoshi Nakamura has <a href="http://snak.tdiary.net/20091020.html">published a Japanese translation</a> of the <a href="http://www.haskell.org/sitewiki/images/8/85/TMR-Issue13.pdf">Typeclassopedia</a>.  I don&#8217;t read any Japanese, but it sure <i>looks</i> cool, and I hope this will be a great resource for Japanese learners of Haskell.  A big thank you to Satoshi for his hard work; the Typeclassopedia is certainly not short!</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/byorgey.wordpress.com/315/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/byorgey.wordpress.com/315/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/byorgey.wordpress.com/315/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/byorgey.wordpress.com/315/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/byorgey.wordpress.com/315/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/byorgey.wordpress.com/315/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/byorgey.wordpress.com/315/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/byorgey.wordpress.com/315/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/byorgey.wordpress.com/315/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/byorgey.wordpress.com/315/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byorgey.wordpress.com&blog=1152889&post=315&subd=byorgey&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://byorgey.wordpress.com/2009/10/20/typeclassopedia-in-japanese/feed/</wfw:commentRss>
		<slash:comments>0</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>Call for submissions: Monad.Reader issue 15</title>
		<link>http://byorgey.wordpress.com/2009/10/12/call-for-submissions-monad-reader-issue-15/</link>
		<comments>http://byorgey.wordpress.com/2009/10/12/call-for-submissions-monad-reader-issue-15/#comments</comments>
		<pubDate>Mon, 12 Oct 2009 14:40:25 +0000</pubDate>
		<dc:creator>Brent</dc:creator>
				<category><![CDATA[haskell]]></category>
		<category><![CDATA[writing]]></category>
		<category><![CDATA[functional programming]]></category>
		<category><![CDATA[Monad.Re]]></category>

		<guid isPermaLink="false">http://byorgey.wordpress.com/?p=308</guid>
		<description><![CDATA[I&#8217;m excited to be taking over the editorship of the Monad.Reader.  I&#8217;ll be putting together Issue 15 in January&#8212;the deadline for submissions will be January 8, 2010.  Please consider writing something!  You don&#8217;t need to be an expert; past articles have included things like tutorials, book reviews, new ideas, beginner perspectives, illustrations [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byorgey.wordpress.com&blog=1152889&post=308&subd=byorgey&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I&#8217;m excited to be <a href="http://article.gmane.org/gmane.comp.lang.haskell.cafe/64213/">taking over the editorship</a> of the <a href="http://themonadreader.wordpress.com/">Monad.Reader</a>.  I&#8217;ll be putting together Issue 15 in January&#8212;the <a href="http://themonadreader.wordpress.com/2009/10/11/call-for-copy-monad-reader-issue-15/">deadline for submissions</a> will be <b>January 8, 2010</b>.  Please consider writing something!  You don&#8217;t need to be an expert; past articles have included things like tutorials, book reviews, new ideas, beginner perspectives, illustrations of nifty code, explanations of a new library or piece of software&#8230;  Collaboration is encouraged, too.  Have a great idea for an article but not sure you could pull it off for one reason or another?  Send an email to <a href="http://haskell.org/haskellwiki/Mailing_lists">haskell-cafe@haskell.org</a> asking for a coauthor.  Writing an article is a great way to learn and to create a high-quality resource for others learning FP.</p>
<p>If you plan to write something&#8212;or are considering it&#8212;let me know.  Submission guidelines can be found on the <a href="http://themonadreader.wordpress.com/contributing/">Monad.Reader website</a>.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/byorgey.wordpress.com/308/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/byorgey.wordpress.com/308/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/byorgey.wordpress.com/308/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/byorgey.wordpress.com/308/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/byorgey.wordpress.com/308/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/byorgey.wordpress.com/308/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/byorgey.wordpress.com/308/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/byorgey.wordpress.com/308/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/byorgey.wordpress.com/308/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/byorgey.wordpress.com/308/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byorgey.wordpress.com&blog=1152889&post=308&subd=byorgey&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://byorgey.wordpress.com/2009/10/12/call-for-submissions-monad-reader-issue-15/feed/</wfw:commentRss>
		<slash:comments>0</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>diagrams 0.2.1, and future plans</title>
		<link>http://byorgey.wordpress.com/2009/09/24/diagrams-0-2-1-and-future-plans/</link>
		<comments>http://byorgey.wordpress.com/2009/09/24/diagrams-0-2-1-and-future-plans/#comments</comments>
		<pubDate>Thu, 24 Sep 2009 19:48:25 +0000</pubDate>
		<dc:creator>Brent</dc:creator>
				<category><![CDATA[haskell]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[constraint solving]]></category>
		<category><![CDATA[declarative]]></category>
		<category><![CDATA[diagrams]]></category>
		<category><![CDATA[drawing]]></category>
		<category><![CDATA[EDSL]]></category>
		<category><![CDATA[rewrite]]></category>

		<guid isPermaLink="false">http://byorgey.wordpress.com/?p=301</guid>
		<description><![CDATA[First of all, I&#8217;ve just released version 0.2.1 of the Haskell diagrams library.  This is a minor release which fixes a few bugs and adds a few new combinators, most notably a grid layout combinator contributed by Ganesh Sittampalam.  For more information and a full list of the features new to 0.2.1, see [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byorgey.wordpress.com&blog=1152889&post=301&subd=byorgey&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>First of all, I&#8217;ve just released version 0.2.1 of the Haskell <a href="http://hackage.haskell.org/package/diagrams">diagrams library</a>.  This is a minor release which fixes a few bugs and adds a few new combinators, most notably a grid layout combinator contributed by Ganesh Sittampalam.  For more information and a full list of the features new to 0.2.1, see the <a href="http://code.haskell.org/diagrams/">diagrams web page</a>.</p>
<p>The real reason for the release, however, is to get existing new features out the door before gearing up for a planned major rewrite of the backend to use a constraint-solving layout engine.  This will allow for much greater elegance and flexibility, as well as a number of features (such as arrows connecting different parts of the diagram) which would be difficult or impossible to implement in the current framework.</p>
<p>My ultimate vision is for the diagrams library to become a viable alternative to declarative drawing systems such as <a href="http://www.tug.org/metapost.html">MetaPost</a> and <a href="http://asymptote.sourceforge.net/">Asymptote</a>, with the distinct advantages that it will be</p>
<ul>
<li><i>purely</i> declarative, and</li>
<li>an <i>embedded</i> DSL, providing the full power of Haskell and its ecosystem, as opposed to the ad-hoc specialized languages used by MetaPost and Asymptote.</li>
</ul>
<p>If this sounds exciting to you, I hope you&#8217;ll join me, either by trying out diagrams for your projects and providing feedback, or by contributing some code.  If you&#8217;re interested in helping with the rewrite itself, let me know; I also plan to set up a core/contrib model like that of <a href="http://xmonad.org">xmonad</a>, so there should also be plenty of opportunities for contributing independent add-on modules which enhance the core functionality.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/byorgey.wordpress.com/301/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/byorgey.wordpress.com/301/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/byorgey.wordpress.com/301/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/byorgey.wordpress.com/301/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/byorgey.wordpress.com/301/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/byorgey.wordpress.com/301/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/byorgey.wordpress.com/301/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/byorgey.wordpress.com/301/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/byorgey.wordpress.com/301/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/byorgey.wordpress.com/301/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byorgey.wordpress.com&blog=1152889&post=301&subd=byorgey&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://byorgey.wordpress.com/2009/09/24/diagrams-0-2-1-and-future-plans/feed/</wfw:commentRss>
		<slash:comments>7</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>Functional MetaPost</title>
		<link>http://byorgey.wordpress.com/2009/09/21/functional-metapost/</link>
		<comments>http://byorgey.wordpress.com/2009/09/21/functional-metapost/#comments</comments>
		<pubDate>Tue, 22 Sep 2009 03:25:14 +0000</pubDate>
		<dc:creator>Brent</dc:creator>
				<category><![CDATA[haskell]]></category>
		<category><![CDATA[errors]]></category>
		<category><![CDATA[funcmp]]></category>
		<category><![CDATA[MetaPost]]></category>

		<guid isPermaLink="false">http://byorgey.wordpress.com/?p=296</guid>
		<description><![CDATA[I just spent a very frustrating hour trying to get the functional MetaPost library (a Haskell DSL for generating MetaPost) working.  It installs (via cabal-install) without a hitch, but I haven&#8217;t been able to get it to actually work.  I can write a test program which imports the FMP module, and compile it, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byorgey.wordpress.com&blog=1152889&post=296&subd=byorgey&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I just spent a very frustrating hour trying to get the <a href="http://cryp.to/funcmp/">functional MetaPost library</a> (a Haskell DSL for generating <a href="http://www.tug.org/metapost.html">MetaPost</a>) working.  It installs (via <a href="http://haskell.org/haskellwiki/Cabal-Install">cabal-install</a>) without a hitch, but I haven&#8217;t been able to get it to actually work.  I can write a test program which imports the FMP module, and compile it, but then when I try to run it, it spews out a gazillion .log, .tmp, .mpx, .aux&#8230; files and a nasty-looking series of error messages (including a segfault).  I&#8217;m happy to provide more details if anyone thinks they would actually be able to help&#8230;</p>
<p>All the more motivation to get back to a rewrite of my <a href="http://code.haskell.org/diagrams/">diagrams library</a>&#8230;</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/byorgey.wordpress.com/296/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/byorgey.wordpress.com/296/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/byorgey.wordpress.com/296/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/byorgey.wordpress.com/296/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/byorgey.wordpress.com/296/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/byorgey.wordpress.com/296/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/byorgey.wordpress.com/296/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/byorgey.wordpress.com/296/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/byorgey.wordpress.com/296/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/byorgey.wordpress.com/296/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byorgey.wordpress.com&blog=1152889&post=296&subd=byorgey&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://byorgey.wordpress.com/2009/09/21/functional-metapost/feed/</wfw:commentRss>
		<slash:comments>12</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>Edinburgh</title>
		<link>http://byorgey.wordpress.com/2009/08/26/edinburgh/</link>
		<comments>http://byorgey.wordpress.com/2009/08/26/edinburgh/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 15:41:53 +0000</pubDate>
		<dc:creator>Brent</dc:creator>
				<category><![CDATA[learning]]></category>
		<category><![CDATA[meta]]></category>
		<category><![CDATA[Edinburgh]]></category>
		<category><![CDATA[pictures]]></category>
		<category><![CDATA[summer school]]></category>

		<guid isPermaLink="false">http://byorgey.wordpress.com/?p=291</guid>
		<description><![CDATA[I&#8217;m having a great time in Edinburgh so far!  I&#8217;m currently at Heriot-Watt University for the International Summer School on Advances in Programming Languages, learning some interesting things but more importantly meeting interesting people.  I&#8217;m also looking forward to meeting yet more interesting people at Hac7 and at ICFP (if you&#8217;re reading this [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byorgey.wordpress.com&blog=1152889&post=291&subd=byorgey&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I&#8217;m having a great time in Edinburgh so far!  I&#8217;m currently at Heriot-Watt University for the <a href="http://www.macs.hw.ac.uk/~greg/ISS-AiPL/">International Summer School on Advances in Programming Languages</a>, learning some interesting things but more importantly meeting interesting people.  I&#8217;m also looking forward to meeting yet more interesting people at <a href="http://www.haskell.org/haskellwiki/Hac7">Hac7</a> and at <a href="http://www.cs.nott.ac.uk/~gmh/icfp09.html">ICFP</a> (if you&#8217;re reading this and plan to be at either, then you are one of them).</p>
<p>Here are <a href="http://yorgeys.smugmug.com/Travel/Edinburgh-2009/">a few pictures I took while sight-seeing</a> on my first day; some pictures of the summer school itself will follow soon.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/byorgey.wordpress.com/291/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/byorgey.wordpress.com/291/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/byorgey.wordpress.com/291/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/byorgey.wordpress.com/291/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/byorgey.wordpress.com/291/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/byorgey.wordpress.com/291/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/byorgey.wordpress.com/291/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/byorgey.wordpress.com/291/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/byorgey.wordpress.com/291/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/byorgey.wordpress.com/291/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byorgey.wordpress.com&blog=1152889&post=291&subd=byorgey&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://byorgey.wordpress.com/2009/08/26/edinburgh/feed/</wfw:commentRss>
		<slash:comments>0</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>New 2D text layout library</title>
		<link>http://byorgey.wordpress.com/2009/08/14/new-2d-text-layout-library/</link>
		<comments>http://byorgey.wordpress.com/2009/08/14/new-2d-text-layout-library/#comments</comments>
		<pubDate>Fri, 14 Aug 2009 16:19:28 +0000</pubDate>
		<dc:creator>Brent</dc:creator>
				<category><![CDATA[haskell]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[boxes]]></category>
		<category><![CDATA[layout]]></category>
		<category><![CDATA[pretty printing]]></category>
		<category><![CDATA[text]]></category>

		<guid isPermaLink="false">http://byorgey.wordpress.com/?p=288</guid>
		<description><![CDATA[I&#8217;ve just uploaded to Hackage a small library, boxes, for 2D text layout/pretty-printing.  This is something I&#8217;ve wanted a couple times and have heard others ask for&#8212;Text.PrettyPrint.HughesPJ, as nice as it is, is intended for pretty-printing only linear output (such as source code), and is ill-suited for layout of a two-dimensional nature, such as [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byorgey.wordpress.com&blog=1152889&post=288&subd=byorgey&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I&#8217;ve just uploaded to Hackage a small library, <a href="http://hackage.haskell.org/package/boxes">boxes</a>, for 2D text layout/pretty-printing.  This is something I&#8217;ve wanted a couple times and have heard others ask for&#8212;<a href="http://hackage.haskell.org/package/pretty">Text.PrettyPrint.HughesPJ</a>, as nice as it is, is intended for pretty-printing only <i>linear</i> output (such as source code), and is ill-suited for layout of a two-dimensional nature, such as columns of text, proof trees, and the like.</p>
<p>I wrote this library almost a year ago and have been sitting on it ever since, and finally decided that I really ought to just release what I have so others can make use of it.  It&#8217;s quite usable as it is, and has (I hope) solid documentation.  There&#8217;s nothing in the way of examples or tutorials or QuickCheck properties, and there are many more features one could imagine adding to it, but it&#8217;s simply not a priority for me right now, so it is what it is.  However, if anyone is interested in taking over as maintainer and extending it, be my guest!  Just fork off a new <a href="http://code.haskell.org/~byorgey/code/boxes/">darcs repo</a> and hack away.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/byorgey.wordpress.com/288/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/byorgey.wordpress.com/288/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/byorgey.wordpress.com/288/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/byorgey.wordpress.com/288/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/byorgey.wordpress.com/288/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/byorgey.wordpress.com/288/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/byorgey.wordpress.com/288/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/byorgey.wordpress.com/288/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/byorgey.wordpress.com/288/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/byorgey.wordpress.com/288/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byorgey.wordpress.com&blog=1152889&post=288&subd=byorgey&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://byorgey.wordpress.com/2009/08/14/new-2d-text-layout-library/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>Going on vacation</title>
		<link>http://byorgey.wordpress.com/2009/08/09/going-on-vacation/</link>
		<comments>http://byorgey.wordpress.com/2009/08/09/going-on-vacation/#comments</comments>
		<pubDate>Sun, 09 Aug 2009 15:05:02 +0000</pubDate>
		<dc:creator>Brent</dc:creator>
				<category><![CDATA[meta]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[vacation]]></category>

		<guid isPermaLink="false">http://byorgey.wordpress.com/?p=286</guid>
		<description><![CDATA[Later today I&#8217;m leaving for a two-week vacation, and I will probably have only very occasional Internet access. If at any point over the next two weeks you wonder why I {didn&#8217;t moderate your comment, didn&#8217;t put out the Haskell Weekly News, am not on IRC, am ignoring your email}, you should remember this.
I&#8217;ll continue [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byorgey.wordpress.com&blog=1152889&post=286&subd=byorgey&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Later today I&#8217;m leaving for a two-week vacation, and I will probably have only very occasional Internet access. If at any point over the next two weeks you wonder why I {didn&#8217;t moderate your comment, didn&#8217;t put out the Haskell Weekly News, am not on IRC, am ignoring your email}, you should remember this.</p>
<p>I&#8217;ll continue writing more about my combinatorial species library when I get back&#8212;including recursively defined species, which I&#8217;m working on at the moment.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/byorgey.wordpress.com/286/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/byorgey.wordpress.com/286/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/byorgey.wordpress.com/286/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/byorgey.wordpress.com/286/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/byorgey.wordpress.com/286/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/byorgey.wordpress.com/286/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/byorgey.wordpress.com/286/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/byorgey.wordpress.com/286/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/byorgey.wordpress.com/286/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/byorgey.wordpress.com/286/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byorgey.wordpress.com&blog=1152889&post=286&subd=byorgey&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://byorgey.wordpress.com/2009/08/09/going-on-vacation/feed/</wfw:commentRss>
		<slash:comments>0</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>Species operations: differentiation</title>
		<link>http://byorgey.wordpress.com/2009/08/05/species-operations-differentiation/</link>
		<comments>http://byorgey.wordpress.com/2009/08/05/species-operations-differentiation/#comments</comments>
		<pubDate>Thu, 06 Aug 2009 03:26:34 +0000</pubDate>
		<dc:creator>Brent</dc:creator>
				<category><![CDATA[combinatorics]]></category>
		<category><![CDATA[haskell]]></category>
		<category><![CDATA[math]]></category>
		<category><![CDATA[combinatorial species]]></category>
		<category><![CDATA[differentiation]]></category>

		<guid isPermaLink="false">http://byorgey.wordpress.com/?p=267</guid>
		<description><![CDATA[Continuing my series describing my new combinatorial species library, today we&#8217;ll take a look at the operation of differentiation.
You may remember that the Species type class has an Algebra.Differential constraint, which, as I previously explained, transitively implies an Algebra.Ring constraint.  But we haven&#8217;t yet talked about the Differential contraint itself, which requires a method [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byorgey.wordpress.com&blog=1152889&post=267&subd=byorgey&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Continuing my series describing my new <a href="http://hackage.haskell.org/package/species">combinatorial species library</a>, today we&#8217;ll take a look at the operation of <i>differentiation</i>.</p>
<p>You may remember that the <code>Species</code> type class has an <code>Algebra.Differential</code> constraint, which, <a href="http://byorgey.wordpress.com/2009/07/30/primitive-species-and-species-operations/">as I previously explained</a>, transitively implies an <code>Algebra.Ring</code> constraint.  But we haven&#8217;t yet talked about the <code>Differential</code> contraint itself, which requires a method <code>differentiate :: Species s =&gt; s -&gt; s</code> (which I will abbreviate using the standard &#8220;prime&#8221; notation), which should satisfy</p>
<p><img src='http://s3.wordpress.com/latex.php?latex=%28x+%2A+y%29%27+%5Cequiv+x%27+%2A+y+%2B+x+%2A+y%27&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='(x * y)&#039; \equiv x&#039; * y + x * y&#039;' title='(x * y)&#039; \equiv x&#039; * y + x * y&#039;' class='latex' /></p>
<p>(up to isomorphism).  Okay, this is just the normal product rule for differentiation, from calculus&#8212;but what on earth could such a thing mean <i>combinatorially</i>?</p>
<p>There is actually a nice, simple answer: an <img src='http://s1.wordpress.com/latex.php?latex=F%27&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='F&#039;' title='F&#039;' class='latex' />-structure on the underlying set <img src='http://s2.wordpress.com/latex.php?latex=U&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='U' title='U' class='latex' /> consists of an <img src='http://s3.wordpress.com/latex.php?latex=F&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='F' title='F' class='latex' />-structure on <img src='http://s1.wordpress.com/latex.php?latex=U+%5Ccup+%5C%7B%2A%5C%7D&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='U \cup \{*\}' title='U \cup \{*\}' class='latex' />, where <img src='http://s2.wordpress.com/latex.php?latex=%2A&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='*' title='*' class='latex' /> is a distinguished element distinct from all the elements of <img src='http://s3.wordpress.com/latex.php?latex=U&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='U' title='U' class='latex' />.  To make the connection to <a href="http://en.wikibooks.org/wiki/Haskell/Zippers#Differentiation_of_data_types">data type differentiation</a>, we can also think of <img src='http://s1.wordpress.com/latex.php?latex=%2A&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='*' title='*' class='latex' /> as a &#8220;hole&#8221;.</p>
<div id="attachment_271" class="wp-caption aligncenter" style="width: 410px"><img src="http://byorgey.files.wordpress.com/2009/08/diff.png?w=400&#038;h=92" alt="Species differentiation" title="diff" width="400" height="92" class="size-full wp-image-271" /><p class="wp-caption-text">Species differentiation</p></div>
<p>The above diagram illustrates the situation: an <img src='http://s2.wordpress.com/latex.php?latex=F%27&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='F&#039;' title='F&#039;' class='latex' />-structure on <img src='http://s3.wordpress.com/latex.php?latex=%5C%7B1%2C2%2C3%2C4%2C5%5C%7D&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='\{1,2,3,4,5\}' title='\{1,2,3,4,5\}' class='latex' /> is an <img src='http://s1.wordpress.com/latex.php?latex=F&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='F' title='F' class='latex' />-structure on <img src='http://s2.wordpress.com/latex.php?latex=%5C%7B1%2C2%2C3%2C4%2C5%2C%2A%5C%7D&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='\{1,2,3,4,5,*\}' title='\{1,2,3,4,5,*\}' class='latex' />.</p>
<p>And how about the law <img src='http://s3.wordpress.com/latex.php?latex=%28F+%2A+G%29%27+%5Cequiv+F%27+%2A+G+%2B+F+%2A+G%27&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='(F * G)&#039; \equiv F&#039; * G + F * G&#039;' title='(F * G)&#039; \equiv F&#039; * G + F * G&#039;' class='latex' />?  Does this make combinatorial sense? (You may want to stop and think about it before reading on!)</p>
<p>By definition, an <img src='http://s1.wordpress.com/latex.php?latex=%28F+%2A+G%29%27&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='(F * G)&#039;' title='(F * G)&#039;' class='latex' />-structure on <img src='http://s2.wordpress.com/latex.php?latex=U&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='U' title='U' class='latex' /> is an <img src='http://s3.wordpress.com/latex.php?latex=%28F%2AG%29&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='(F*G)' title='(F*G)' class='latex' />-structure on <img src='http://s1.wordpress.com/latex.php?latex=U+%5Ccup+%5C%7B%2A%5C%7D&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='U \cup \{*\}' title='U \cup \{*\}' class='latex' />, which is a pair of an <img src='http://s2.wordpress.com/latex.php?latex=F&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='F' title='F' class='latex' />-structure and a <img src='http://s3.wordpress.com/latex.php?latex=G&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='G' title='G' class='latex' />-structure on a splitting (a two-partition) of <img src='http://s1.wordpress.com/latex.php?latex=U+%5Ccup+%5C%7B%2A%5C%7D&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='U \cup \{*\}' title='U \cup \{*\}' class='latex' />.  The distinguished <img src='http://s2.wordpress.com/latex.php?latex=%2A&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='*' title='*' class='latex' /> label must end up on one side or the other, so an <img src='http://s3.wordpress.com/latex.php?latex=%28F%2AG%29%27&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='(F*G)&#039;' title='(F*G)&#039;' class='latex' />-structure can arise in one of two ways: it is either an <img src='http://s1.wordpress.com/latex.php?latex=F%27&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='F&#039;' title='F&#039;' class='latex' />-structure paired with a <img src='http://s2.wordpress.com/latex.php?latex=G&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='G' title='G' class='latex' />-structure, or an <img src='http://s3.wordpress.com/latex.php?latex=F&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='F' title='F' class='latex' />-structure paired with a <img src='http://s1.wordpress.com/latex.php?latex=G%27&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='G&#039;' title='G&#039;' class='latex' />-structure, depending on where the <img src='http://s2.wordpress.com/latex.php?latex=%2A&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='*' title='*' class='latex' /> ends up.  But this is precisely saying that <img src='http://s3.wordpress.com/latex.php?latex=%28F+%2A+G%29%27+%5Cequiv+F%27+%2A+G+%2B+F+%2A+G%27&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='(F * G)&#039; \equiv F&#039; * G + F * G&#039;' title='(F * G)&#039; \equiv F&#039; * G + F * G&#039;' class='latex' />!</p>
<p>Where does species differentiation show up?  The most well-known place is in defining the species <img src='http://s1.wordpress.com/latex.php?latex=L&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='L' title='L' class='latex' /> of <i>lists</i> (linear orderings).  In fact,</p>
<p><img src='http://s2.wordpress.com/latex.php?latex=L+%3D+C%27&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='L = C&#039;' title='L = C&#039;' class='latex' />,</p>
<p>that is, the species <img src='http://s3.wordpress.com/latex.php?latex=L&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='L' title='L' class='latex' /> is the derivative of the <a href="http://byorgey.wordpress.com/2009/07/31/primitive-species-and-species-operations-part-ii/">species <img src='http://s1.wordpress.com/latex.php?latex=C&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='C' title='C' class='latex' /> of cycles</a>.  A cycle defines an ordering, but there is no distinguished beginning or end; by making a cycle out of some elements with a distinguished extra element <img src='http://s2.wordpress.com/latex.php?latex=%2A&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='*' title='*' class='latex' />, we uniquely identify a beginning/end of the ordering on the original elements: a list!</p>
<div id="attachment_274" class="wp-caption aligncenter" style="width: 410px"><img src="http://byorgey.files.wordpress.com/2009/08/cyclediff.png?w=400&#038;h=137" alt="Differentiating a cycle to get a list" title="cyclediff" width="400" height="137" class="size-full wp-image-274" /><p class="wp-caption-text">Differentiating a cycle to get a list</p></div>
<p><code><br />
&gt; take 10 . labelled $ lists<br />
[1,1,2,6,24,120,720,5040,40320,362880]<br />
&gt; take 10 . labelled $ oneHole cycles<br />
[1,1,2,6,24,120,720,5040,40320,362880]<br />
&gt; generate lists ([1..3] :: [Int])<br />
[[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]<br />
&gt; generate (oneHole cycles) ([1..3] :: [Int])<br />
[&lt;*,1,2,3&gt;,&lt;*,1,3,2&gt;,&lt;*,2,1,3&gt;,&lt;*,2,3,1&gt;,&lt;*,3,1,2&gt;,&lt;*,3,2,1&gt;]<br />
</code></p>
<p>Here&#8217;s an example of differentiation in action.  In the species library, the function <code>oneHole</code> is provided as a synonym for <code>differentiate</code>.  The session above shows that there are the same number of labelled lists as labelled one-hole cycles: this isn&#8217;t surprising given the discussion above, and in fact, <code>list</code> is actually implemented as <code>oneHole cycle</code>.  Actually, this is a tiny lie, as the rest of the session shows: since lists are such a common combinatorial structure, there is a special case for them in the generation code.  But we can explicitly generate one-hole cycles as above; it&#8217;s easy to see that they are in one-to-one correspondence with the lists.</p>
<p>To finish off this post, a few exercises for you (you can check your answers with the species library):</p>
<ol>
<li>Describe the species <img src='http://s3.wordpress.com/latex.php?latex=1%27&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='1&#039;' title='1&#039;' class='latex' />.</li>
<li>Describe the species <img src='http://s1.wordpress.com/latex.php?latex=X%27&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='X&#039;' title='X&#039;' class='latex' />.</li>
<li>Describe the species <img src='http://s2.wordpress.com/latex.php?latex=E%27&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='E&#039;' title='E&#039;' class='latex' />.</li>
<li>Does differentiation distribute over addition?  That is, is it true that <img src='http://s3.wordpress.com/latex.php?latex=%28F+%2B+G%29%27+%5Cequiv+F%27+%2B+G%27&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='(F + G)&#039; \equiv F&#039; + G&#039;' title='(F + G)&#039; \equiv F&#039; + G&#039;' class='latex' /> for any species <img src='http://s1.wordpress.com/latex.php?latex=F&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='F' title='F' class='latex' /> and <img src='http://s2.wordpress.com/latex.php?latex=G&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='G' title='G' class='latex' />?  Give a combinatorial interpretation of this identity, or say why it does not hold.</li>
<li>Describe the species <img src='http://s3.wordpress.com/latex.php?latex=L%27&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='L&#039;' title='L&#039;' class='latex' />.</li>
<li>Describe the species <img src='http://s1.wordpress.com/latex.php?latex=C%5E%7B%28n%29%7D&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='C^{(n)}' title='C^{(n)}' class='latex' /> (i.e. the nth derivative of the species of cycles).</li>
</ol>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/byorgey.wordpress.com/267/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/byorgey.wordpress.com/267/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/byorgey.wordpress.com/267/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/byorgey.wordpress.com/267/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/byorgey.wordpress.com/267/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/byorgey.wordpress.com/267/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/byorgey.wordpress.com/267/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/byorgey.wordpress.com/267/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/byorgey.wordpress.com/267/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/byorgey.wordpress.com/267/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byorgey.wordpress.com&blog=1152889&post=267&subd=byorgey&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://byorgey.wordpress.com/2009/08/05/species-operations-differentiation/feed/</wfw:commentRss>
		<slash:comments>0</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>

		<media:content url="http://byorgey.files.wordpress.com/2009/08/diff.png" medium="image">
			<media:title type="html">diff</media:title>
		</media:content>

		<media:content url="http://byorgey.files.wordpress.com/2009/08/cyclediff.png" medium="image">
			<media:title type="html">cyclediff</media:title>
		</media:content>
	</item>
		<item>
		<title>Primitive species and species operations, part II</title>
		<link>http://byorgey.wordpress.com/2009/07/31/primitive-species-and-species-operations-part-ii/</link>
		<comments>http://byorgey.wordpress.com/2009/07/31/primitive-species-and-species-operations-part-ii/#comments</comments>
		<pubDate>Sat, 01 Aug 2009 01:31:03 +0000</pubDate>
		<dc:creator>Brent</dc:creator>
				<category><![CDATA[combinatorics]]></category>
		<category><![CDATA[haskell]]></category>
		<category><![CDATA[math]]></category>
		<category><![CDATA[combinatorial species]]></category>
		<category><![CDATA[cycles]]></category>
		<category><![CDATA[sets]]></category>
		<category><![CDATA[singletons]]></category>

		<guid isPermaLink="false">http://byorgey.wordpress.com/?p=237</guid>
		<description><![CDATA[In my previous post, I began describing the primitive species and species operations supported by my combinatorial species library; we looked at the ring structure on species, that is, the primitive species  and , and the operations of species sum and product.  Today we&#8217;ll continue by looking at a few more primitive species: [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byorgey.wordpress.com&blog=1152889&post=237&subd=byorgey&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>In <a href="http://byorgey.wordpress.com/2009/07/30/primitive-species-and-species-operations/">my previous post</a>, I began describing the primitive species and species operations supported by my <a href="http://hackage.haskell.org/package/species">combinatorial species library</a>; we looked at the ring structure on species, that is, the primitive species <img src='http://s1.wordpress.com/latex.php?latex=0&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='0' title='0' class='latex' /> and <img src='http://s2.wordpress.com/latex.php?latex=1&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='1' title='1' class='latex' />, and the operations of species sum and product.  Today we&#8217;ll continue by looking at a few more primitive species: <i>singletons</i>, <i>sets</i>, and <i>cycles</i>.</p>
<p>[By the way, all the diagrams for this post and the previous one were generated programmatically using my <a href="http://code.haskell.org/diagrams/">diagrams</a> library.  I'll probably put the code up as an example on the diagrams website sometime in the near future.]</p>
<h3>X</h3>
<p>The species <img src='http://s3.wordpress.com/latex.php?latex=X&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='X' title='X' class='latex' />, also known as the species of <i>singletons</i>, is picky in a way similar to the species <img src='http://s1.wordpress.com/latex.php?latex=1&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='1' title='1' class='latex' />.  Whereas <img src='http://s2.wordpress.com/latex.php?latex=1&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='1' title='1' class='latex' /> only puts a structure on the empty set of labels, X only puts a (single) structure on singleton label sets.  If you give it more than one label, or none, it turns up its nose and refuses to do anything.</p>
<div id="attachment_227" class="wp-caption aligncenter" style="width: 410px"><img src="http://byorgey.files.wordpress.com/2009/07/singleton.png?w=400&#038;h=92" alt="The species X of singletons" title="singleton" width="400" height="92" class="size-full wp-image-227" /><p class="wp-caption-text">The species X of singletons</p></div>
<p><code><br />
&gt; take 10 $ labelled singleton<br />
[0,1,0,0,0,0,0,0,0,0]<br />
&gt; generate singleton (['a'] :: [Char])<br />
['a']<br />
&gt; generate singleton ("abc" :: [Char])<br />
[]<br />
</code></p>
<p>A few exercises: try to work them out yourself, then use the species library to check if you are correct!</p>
<ol>
<li>Describe the species <img src='http://s3.wordpress.com/latex.php?latex=X+%2B+X&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='X + X' title='X + X' class='latex' />.  Show that it is isomorphic to the species <img src='http://s1.wordpress.com/latex.php?latex=2+%2A+X&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='2 * X' title='2 * X' class='latex' />.</li>
<li>Describe the species <img src='http://s2.wordpress.com/latex.php?latex=X+%2A+X&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='X * X' title='X * X' class='latex' />.</li>
</ol>
<h3>E</h3>
<p>The species <img src='http://s3.wordpress.com/latex.php?latex=E&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='E' title='E' class='latex' /> of sets, on the other hand, isn&#8217;t picky at all: it will happily put a singleton structure on any label set.  Usually we identify this structure with the label set itself; that is, the only <img src='http://s1.wordpress.com/latex.php?latex=E&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='E' title='E' class='latex' />-structure on a label set <img src='http://s2.wordpress.com/latex.php?latex=U&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='U' title='U' class='latex' /> is <img src='http://s3.wordpress.com/latex.php?latex=U&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='U' title='U' class='latex' /> itself.</p>
<div id="attachment_258" class="wp-caption aligncenter" style="width: 410px"><img src="http://byorgey.files.wordpress.com/2009/07/set1.png?w=400&#038;h=92" alt="The species E of sets" title="set" width="400" height="92" class="size-full wp-image-258" /><p class="wp-caption-text">The species E of sets</p></div>
<p><code><br />
&gt; take 10 $ labelled sets<br />
[1,1,1,1,1,1,1,1,1,1]<br />
&gt; take 10 $ unlabelled sets<br />
[1,1,1,1,1,1,1,1,1,1]<br />
&gt; generate set ([1..3] :: [Int])<br />
[{1,2,3}]<br />
&gt; generate set ([] :: [Int])<br />
[{}]<br />
</code></p>
<p>We can now also describe the derived species <img src='http://s1.wordpress.com/latex.php?latex=X+%2A+E&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='X * E' title='X * E' class='latex' /> of <i>elements</i>, also known as the species of <i>pointed sets</i>.  The only way to get any <img src='http://s2.wordpress.com/latex.php?latex=X+%2A+E&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='X * E' title='X * E' class='latex' /> structures is by partitioning the label set <img src='http://s3.wordpress.com/latex.php?latex=U&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='U' title='U' class='latex' /> into a singleton and all the rest, in which case we get exactly one structure; so there is one <img src='http://s1.wordpress.com/latex.php?latex=X+%2A+E&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='X * E' title='X * E' class='latex' /> structure for each element of <img src='http://s2.wordpress.com/latex.php?latex=U&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='U' title='U' class='latex' />.</p>
<p><code><br />
&gt; take 10 $ labelled (x * set)<br />
[0,1,2,3,4,5,6,7,8,9]<br />
&gt; take 10 $ unlabelled (x * set)<br />
[0,1,1,1,1,1,1,1,1,1]<br />
&gt; generate (x * set) ([1..3] :: [Int])<br />
[(1,{2,3}),(2,{1,3}),(3,{1,2})]<br />
</code></p>
<p>(<code>x</code> is just a synonym for <code>singleton</code>.)  Noteworthy is the fact that this is the first species we&#8217;ve looked at which has different numbers of labelled and unlabelled structures!  This makes sense: there are <img src='http://s3.wordpress.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='n' title='n' class='latex' /> labelled <img src='http://s1.wordpress.com/latex.php?latex=%28X+%2A+E%29&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='(X * E)' title='(X * E)' class='latex' />-structures on a size <img src='http://s2.wordpress.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='n' title='n' class='latex' /> set; but if we can&#8217;t tell the difference between the labels, any one of them is just as good as any other, so we only get one unlabelled structure (unless the label set is empty, when we don&#8217;t get any structures: the <img src='http://s3.wordpress.com/latex.php?latex=X&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='X' title='X' class='latex' /> still requires us to have at least one element!).  Note also that <code>element</code> is a special synonym for <code>x * set</code> with a special semantics under <code>generate</code>: if we really want to pick <i>elements</i> of the label set, then we probably don&#8217;t want to actually see each element paired with a set of the leftover elements, we just want to see the element itself:</p>
<p><code><br />
&gt; generate elements ([1..3]::[Int])<br />
[1,2,3]<br />
</code></p>
<h3>C</h3>
<p>The final primitive species&#8212;and the only one so far that doesn&#8217;t feel quite so utterly trivial&#8212;is the species <img src='http://s1.wordpress.com/latex.php?latex=C&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='C' title='C' class='latex' /> of <i>cycles</i>.  <img src='http://s2.wordpress.com/latex.php?latex=C&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='C' title='C' class='latex' /> puts no structures on an empty label set, but given any non-empty label set, <img src='http://s3.wordpress.com/latex.php?latex=C&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='C' title='C' class='latex' /> generates the set of all <i>cyclical orderings</i> of the labels.  </p>
<div id="attachment_259" class="wp-caption aligncenter" style="width: 410px"><img src="http://byorgey.files.wordpress.com/2009/07/cycle1.png?w=400&#038;h=92" alt="The species C of cycles" title="cycle" width="400" height="92" class="size-full wp-image-259" /><p class="wp-caption-text">The species C of cycles</p></div>
<p>Of course, the above diagram only shows six of the cycle structures on five labels; the ellipsis is meant to suggest the others not shown. So&#8230; how many labelled cycle structures <i>are</i> there on five labels, or generally on <img src='http://s1.wordpress.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='n' title='n' class='latex' /> labels?  (Of course there is only one <i>un</i>labelled <img src='http://s2.wordpress.com/latex.php?latex=n&#038;bg=ffffff&#038;fg=333333&#038;s=0' alt='n' title='n' class='latex' />-cycle.)  I&#8217;ll leave it as a (hopefully easy) exercise; and of course you know how to check your answer!</p>
<p><code><br />
&gt; generate cycles ([1..4] :: [Int])<br />
[&lt;1,2,3,4&gt;,&lt;1,2,4,3&gt;,&lt;1,3,2,4&gt;,&lt;1,3,4,2&gt;,&lt;1,4,2,3&gt;,&lt;1,4,3,2&gt;]<br />
</code></p>
<p>As you can see, cycles are indicated with angle brackets; it is understood that <code>&lt;1,2,3,4&gt;</code>, <code>&lt;2,3,4,1&gt;</code>, <code>&lt;3,4,1,2&gt;</code>, and <code>&lt;4,1,2,3&gt;</code> are all equivalent.</p>
<p>At this point, you&#8217;re probably thinking about a certain species and wondering why I haven&#8217;t mentioned it yet&#8212;it seems pretty fundamental and primitive.  Are you thinking of&#8230; the species of <i>lists</i>?  It turns out that we don&#8217;t have to take lists as primitive&#8212;we can define the species of lists as the <i>derivative</i> of the species of cycles!  <a href="http://strictlypositive.org/diff.pdf">The derivative of a regular type is its type of one-hole</a>&#8230; but I&#8217;m getting ahead of myself.  We&#8217;ll look at species differentiation (along with several other operations on species) in the next post!</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/byorgey.wordpress.com/237/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/byorgey.wordpress.com/237/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/byorgey.wordpress.com/237/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/byorgey.wordpress.com/237/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/byorgey.wordpress.com/237/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/byorgey.wordpress.com/237/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/byorgey.wordpress.com/237/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/byorgey.wordpress.com/237/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/byorgey.wordpress.com/237/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/byorgey.wordpress.com/237/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byorgey.wordpress.com&blog=1152889&post=237&subd=byorgey&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://byorgey.wordpress.com/2009/07/31/primitive-species-and-species-operations-part-ii/feed/</wfw:commentRss>
		<slash:comments>1</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>

		<media:content url="http://byorgey.files.wordpress.com/2009/07/singleton.png" medium="image">
			<media:title type="html">singleton</media:title>
		</media:content>

		<media:content url="http://byorgey.files.wordpress.com/2009/07/set1.png" medium="image">
			<media:title type="html">set</media:title>
		</media:content>

		<media:content url="http://byorgey.files.wordpress.com/2009/07/cycle1.png" medium="image">
			<media:title type="html">cycle</media:title>
		</media:content>
	</item>
	</channel>
</rss>