<div>This is a little off-topic, since it isn&#39;t specifically about Haskell, but since Haskell is the home of the monad tutorial it isn&#39;t completely irrelevant.  The monad tutorial genre is well-known; it&#39;s often written somebody who has just learned the concept trying to explain it, often in highly imaginative terms (e.g. &quot;a monad is just like a giant squid, with special tentacles&quot;).  I propose &quot;monad co-tutorial&quot; for attempts, often by an amateur (e.g. me) to work out how a monad appears in an unexpected place.  </div>
<div><br></div><div>In particular, I recently suffered through a few days of learning to deal with Ant and Maven2, which got me thinking about build systems in general, which got me thinking about the (meta-)language used in such systems, which got me thinking about What It&#39;s Really All About.</div>
<div><br></div><div>Lo and behold - a monad!  I think, anyway.  The basic idea is that program texts (source or object code) are to programs as sentences are to propositions.  Compilation transforms one representation into another.  This can be viewed in terms of the unit natural transformation of a monad of transformations over program representations.  The multiplication component captures the fact that program text transformations can be chained, as in macro expansion, phased optimization, etc.</div>
<div><br></div><div>I&#39;m not sure if this works, but it fits my somewhat limited idea of monads, so I wrote an <a href="http://blog.mobileink.com/">article</a> about it and I&#39;d appreciate any corrections.  I expect if it does work somebody has already done something like it, so I would appreciate any pointers to more info.  My real goal is to think about better language for software build systems, since what we have now is pretty weak, in my view.  One thing that follows from thinking in terms of monads is that we can discard the notion of dependency of object code of source code in favor of a notion of equivalence (i.e. unit transform).  My hunch is that thinking along such lines might lead to an improved metalanguage for build DSLs.</div>
<div><br></div><div>Thanks,</div><div><br></div><div>Gregg</div>