<?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>Control.Monad.Writer</title>
	<atom:link href="https://donsbot.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>https://donsbot.wordpress.com</link>
	<description>A Journal of Haskell Programming</description>
	<lastBuildDate>Sun, 08 Jan 2012 21:31:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='donsbot.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>https://secure.gravatar.com/blavatar/7bd377fd2f09ce3d90665bb79e5fab5b?s=96&#038;d=https%3A%2F%2Fs-ssl.wordpress.com%2Fi%2Fbuttonw-com.png</url>
		<title>Control.Monad.Writer</title>
		<link>https://donsbot.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="https://donsbot.wordpress.com/osd.xml" title="Control.Monad.Writer" />
	<atom:link rel='hub' href='https://donsbot.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Painless NP-complete problems: an embedded DSL for SMT solving</title>
		<link>https://donsbot.wordpress.com/2011/01/16/painless-np-complete-problems-an-embedded-dsl-for-smt-solving/</link>
		<comments>https://donsbot.wordpress.com/2011/01/16/painless-np-complete-problems-an-embedded-dsl-for-smt-solving/#comments</comments>
		<pubDate>Sun, 16 Jan 2011 21:41:34 +0000</pubDate>
		<dc:creator>Don Stewart</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[dsl]]></category>
		<category><![CDATA[language]]></category>
		<category><![CDATA[types]]></category>

		<guid isPermaLink="false">http://donsbot.wordpress.com/?p=642</guid>
		<description><![CDATA[SMT solvers are automated tools to solve the &#8220;Satisfiability Modulo Theories&#8221; problem &#8212; that is, determining whether a given logical formula can be satisfied. However, unlike SAT solvers, SMT solvers generalize to solving such NP-complete problems that contain not just boolean variables, but more useful types, such as lists, tuples, arrays, integers and reals. And [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=donsbot.wordpress.com&amp;blog=6244403&amp;post=642&amp;subd=donsbot&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.edwardtufte.com/bboard/images/0003Nw-8838.png"><img class="alignright size-medium wp-image-689" title="Relationships between NP-complete problems" src="http://donsbot.files.wordpress.com/2011/01/sat3.png?w=300&#038;h=267" alt="" width="300" height="267" /></a><a href="http://en.wikipedia.org/wiki/Satisfiability_Modulo_Theories">SMT solvers</a> are automated tools to solve the &#8220;Satisfiability Modulo Theories&#8221; problem &#8212; that is, determining whether a given logical formula can be <em><a href="http://en.wikipedia.org/wiki/Boolean_satisfiability_problem">satisfied</a>. </em>However, unlike <a href="http://en.wikipedia.org/wiki/Boolean_satisfiability_problem#Algorithms_for_solving_SAT">SAT solvers</a>, SMT solvers generalize to <a href="http://en.wikipedia.org/wiki/Boolean_satisfiability_problem#Complexity_and_restricted_versions">solving such NP-complete</a> problems that contain not just boolean variables, but more useful types, such as lists, tuples, arrays, integers and reals. And they do this while retaining very good performance (with <a href="http://www.smtcomp.org/2011/">yearly shootouts</a> for the best solvers). As a result, <strong>SMT solvers provide a big hammer for solving many difficult problems automatically.</strong></p>
<p>They are so interesting they&#8217;ve been described as a <a href="https://docs.google.com/viewer?url=fm.cs.uiuc.edu/talks/060406/slides.pdf">disruptive technology</a> in formal methods. They are more automated than interactive theorem provers, while still providing high-end expressive capability.</p>
<p>And they&#8217;re growing in use in industrial applications. In the <a href="http://corp.galois.com/cryptol/">Cryptol</a> toolset, for example, SMT solvers are used to determine if two implementations of a cryptographic function are functionally identical;  Microsoft uses SMT solvers for <a href="http://research.microsoft.com/en-us/projects/slam/">device driver verification</a>; and they&#8217;ve been used for large scale test generation, planning and routing problems.</p>
<p>The challenge now is to make such power easily available to programmers without a formal methods background.</p>
<p>To do this, my approach is to embed the SMT solver into a good programming language, as an embedded DSL. Embedded languages let us hide significant complexity, using the host language&#8217;s combining forms to build up complex structures from simple primitives &#8212; instead of starting with a complex API in the first place.</p>
<p>If you already know the host language, you can program in the EDSL. If you know Haskell, you can program an SMT solver.</p>
<p>The code is available:</p>
<ul>
<li>cabal install <a href="http://hackage.haskell.org/package/yices-painless">yices-painless</a> <em>(depends on an install of Yices from SRI)</em></li>
<li>darcs get <a href="http://code.haskell.org/~dons/code/yices-painless/">http://code.haskell.org/~dons/code/yices-painless/</a></li>
<li><a href="http://www.galois.com/~dons/yices-painless/">Haddock documentation</a> <em>(since Hackage won&#8217;t generate the docs without Yices headers)</em></li>
</ul>
<h2>Scripting a Solver</h2>
<p>SMT solvers are typically scripted in an imperative fashion: variables are declared, and then facts about those variables are asserted, step by step. The resulting set of declarations is passed to the solver to determine satisifiability (and to find any satisfying values to assign to the variables, if possible). From a programming language perspective, these declarations and assertions look like (typed) (pure) functions with<a href="http://en.wikipedia.org/wiki/Free_variables_and_bound_variables"> free variables</a>.</p>
<p>The standard <a href="http://goedel.cs.uiowa.edu/smtlib/">SMT-LIB format</a> (accepted by most SMT solvers) looks something like:</p>
<p><code> (define p::bool)<br />
(define q::bool)<br />
(define r::bool)<br />
(assert (=&gt; (and (=&gt; p q) (=&gt; q r)) (=&gt; p r)))</code></p>
<p>Which we&#8217;ll write in our EDSL in Haskell as:</p>
<p><code>\p q r -&gt; (p → q &amp;&amp; q → r) → (p → r)</code></p>
<p>Haskell&#8217;s type inference can fill in the types in the EDSL, and infix notation also helps clean things up.</p>
<p>Such a proposition may be passed to a solver, like so:</p>
<p><code> &gt; solve $ \p q r -&gt; (p → q &amp;&amp; q → r) → (p → r)<br />
</code></p>
<p><code> Satisfiable!<br />
r =&gt; False<br />
q =&gt; True<br />
p =&gt; True</code></p>
<p>We start with something that looks like a Haskell function (but is actually a function in the EDSL), which can be interpreted by a solver, with Haskell&#8217;s language machinery filling in types, and checking safety.</p>
<p>In this post I&#8217;ll talk about how I designed <a href="http://hackage.haskell.org/package/yices-painless">yices-painless</a>, an EDSL that embeds SMT scripting support deeply into Haskell (deeply, in that the Haskell type system will check the types of the SMT propositions). The work is based on the language embedding approach taken by Chakravarty et al&#8217;s, <a href="http://www.cse.unsw.edu.au/~chak/papers/CKLM+11.html">accelerate</a> arrays language (for GPU programming), using <a href="http://en.wikipedia.org/wiki/Higher-order_abstract_syntax#Relation_to_first-order_abstract_syntax">higher-order abstract syntax</a> to support elegant variable binding, with a type-preserving translation to a form that can be executed by the underlying solver.</p>
<h2>Designing the EDSL</h2>
<p><img class="size-full wp-image-647 alignright" title="drawing" src="http://donsbot.files.wordpress.com/2011/01/drawing.png?w=575" alt=""   /></p>
<p>For a client problem at work, I was interested in trying an SMT solver.  The <a href="http://yices.csl.sri.com/index.shtml">Yices SMT solver</a> from SRI is a high-performance SMT solver with a well-documented C interface, which is a good place to start experimenting. The design challenge was to get from the imperative C interface we have to use, to the typed, pure Haskell embedding that we want to write.</p>
<p>To do this, we build up several layers of abstraction, each one removing redundancy and hiding unnecessary complexity:</p>
<ol>
<li>The base layer, Yices itself, a big blob of compiled C or C++ code, exporting 150+ functions.</li>
<li><a href="http://www.galois.com/~dons/yices-painless/Yices-Painless-Base-C.html">Yices.Painless.Base.C</a>: Stitching Yices to Haskell via a full (and straightforward) FFI bindings (150+ Haskell functions, and a few types)</li>
<li><a href="http://www.galois.com/~dons/yices-painless/Yices-Painless-Base.html">Yices.Painless.Base</a>: The FFI bindings are just as unsafe as the C layer, so in the next abstraction layer we automate the resource managment, use native Haskell types, and native Haskell abstractions (e.g. lazy lists instead of iteratees). The number of functions exposed is reduced as a result, making the API simpler. This layer is still imperative (all functions are in IO), but relatively useful.</li>
<li><a href="http://www.galois.com/~dons/yices-painless/Yices-Painless-Language.html">Yices.Painless.Language</a>: The AST layers are the big step up in expressive power: we design an abstract syntax tree to represent the embedded language, along with a set of primitive functions and types. This pure data structure will be interpreted (or compiled to SMT-LIB format), generating calls to the imperative layer. We thus have very strong separation between the messy, error-prone imperative model, and the correct-by-construction pure AST.  We have just simple constants, variables, conditions and a handful of (polymorphic) primitive functions, relying on the language to build up complex expressions from a few simple forms.</li>
<li><a href="http://www.galois.com/~dons/yices-painless/Yices-Painless-Language.html#3">Surface Syntax</a>: Finally, we expose the EDSL language via smart surface syntax, overloaded via Haskell&#8217;s type classes: Bits, Num, String. And now programmers need only use Haskell&#8217;s native math and bit functions, syntax and types, to build propositions. Type inference and checking works, as well as proper scoping of variables in the propositions. This <a href="http://www.galois.com/~dons/yices-painless/Yices-Painless-Language.html">user-facing layer</a> looks and feels exactly like Haskell, yet it is translated to a form that drives an imperative C library.</li>
</ol>
<p>The surface layer reveals the power of a good EDSL: hiding unnecessary complexity, increasing expressivity (compare the few functions (and combinators) <a href="http://www.galois.com/~dons/yices-painless/Yices-Painless-Language.html#3">in the EDSL layer</a> at the top, with the <a href="http://yices.csl.sri.com/capi.shtml">150+ functions</a> in the C API).</p>
<p><strong>The EDSL reduces the cognitive load on the programmer by an order of magnitude.</strong></p>
<h2><strong>Implementation</strong></h2>
<h3>The Base Layers</h3>
<p>The base layers are  the most straightforward part of the system. First, we write  <a href="http://www.galois.com/~dons/yices-painless/src/Yices-Painless-Base-C.html#YExpr">a natural FFI binding</a> to every function exposed by the Yices C API. Each C function gets an FFI import; value types are represented by types defined in the Haskell FFI report (e.g. CInt, CString), while Yices types allocated and controlled by Yices are typed in Haskell with empty data  types (e.g. <a href="http://www.galois.com/~dons/yices-painless/src/Yices-Painless-Base-C.html#YExpr">YExpr</a>), giving us increased type safety (compared to using void pointers).</p>
<p>The FFI layer is then wrapped in resource handling code, <a href="http://www.galois.com/~dons/yices-painless/src/Yices-Painless-Base.html#getDecls">hiding a set of functions</a> from an C++ iterator behind a single function returning a lazy list). The FFI bindings are about 350 lines of code; the wrapper layer another 500. Most of this can be generated.</p>
<h3>The Typed AST</h3>
<p>Following <a href="http://www.cse.unsw.edu.au/~chak/haskell/term-conv/">Chakravarty&#8217;s approach</a>, we represent the embedded language with a surface syntax (supporting numerical and scalar polymorphic operations), which builds a <em>nameless </em>AST  (variables in the EDSL are represented as Haskell variables). The typed embedding gives us a type checker for the DSL for free. The AST is decorated with type information, so we can resolve overloading (in the EDSL), and do other type-based operations. The EDSL itself is just over 1000 lines of Haskell.</p>
<p>The language is relatively simple: variables (of any scalar type), literals (of any scalar type), conditionals, and a range of built-in functions. Variables are bound/quantified at the top level of the EDSL.</p>
<pre>data Exp t where
    Tag         :: (IsScalar t) =&gt; Int        -&gt; Exp t
    Const       :: (IsScalar t) =&gt; t          -&gt; Exp t
    Cond        :: Exp Bool -&gt; Exp t -&gt; Exp t -&gt; Exp t
    PrimApp     :: PrimFun (a -&gt; r) -&gt; Exp a  -&gt; Exp r

data PrimFun t where
    PrimEq   :: ScalarType a -&gt; PrimFun ((a, a) -&gt; Bool)
    PrimNEq  :: ScalarType a -&gt; PrimFun ((a, a) -&gt; Bool)

    PrimAdd  :: NumType a -&gt; PrimFun ((a, a) -&gt; a)
    PrimSub  :: NumType a -&gt; PrimFun ((a, a) -&gt; a)
    PrimMul  :: NumType a -&gt; PrimFun ((a, a) -&gt; a)
    ...</pre>
<p>We can expose these via a type class interface for Exp things, yielding nice surface syntax: (+), (*), (==*), and (/=*). It isn&#8217;t possible to write sensible instance of Eq, sadly, as those Haskell type classes wire in return types of Bool (instead of a polymorphic Boolean class). We have to redefine (==) instead.</p>
<pre>instance (IsNum t) =&gt; Num (Exp t) where
  (+)         = mkAdd
  (-)         = mkSub
  (*)         = mkMul

infix 4 ==*, /=*, &lt;*, &lt;=*, &gt;*, &gt;=*

-- | Equality lifted into Yices expressions.
(==*) :: (IsScalar t) =&gt; Exp t -&gt; Exp t -&gt; Exp Bool
(==*) = mkEq

-- |Inequality lifted into Yices expressions.
(/=*) :: (IsScalar t) =&gt; Exp t -&gt; Exp t -&gt; Exp Bool
(/=*) = mkNEq</pre>
<p>The smart constructors build AST nodes, with type information added:</p>
<pre>mkAdd :: (IsNum t) =&gt; Exp t -&gt; Exp t -&gt; Exp t
mkAdd x y = PrimAdd numType `PrimApp` tup2 (x, y)

mkMul :: (IsNum t) =&gt; Exp t -&gt; Exp t -&gt; Exp t
mkMul x y = PrimMul numType `PrimApp` tup2 (x, y)

mkEq   :: (IsScalar t) =&gt; Exp t -&gt; Exp t -&gt; Exp Bool
mkEq   x y = PrimEq  scalarType `PrimApp` tup2 (x, y)

mkNEq  :: (IsScalar t) =&gt; Exp t -&gt; Exp t -&gt; Exp Bool
mkNEq  x y = PrimNEq scalarType `PrimApp` tup2 (x, y)</pre>
<h3>Converting to de Bruijn form</h3>
<p>This nameless form (via surface syntax) is convenient to write, and solves all the issues with binders for us, but harder to optimize (as propositions are reprsented as opaque functions). So this form is then converted to a form with explicit variables (represented as de Bruijn indices into a variable environment). The approach is identical to the one taken in<a href="http://www.cse.unsw.edu.au/~chak/papers/acc-cuda.pdf"> the accelerate EDSL</a>, with the change that at the top level we support n-ary functions (to represent propositions with n free variables).</p>
<p>Thanks to Trevor Elliott, and for historical reference, we can convert n-ary functions to their de Bruijn form via a type class, yielding a common type for propositions with arbitrary variables: <code>:: Yices f r =&gt; f -&gt; Prop r</code></p>
<h3>Running the Solver</h3>
<p>Once we&#8217;ve built the AST for the proposition, and replaced all variables with their de Bruijn tags, we can now execute the proposition, recursively calling Yices operations to reconstruct the AST on the Yices side, before asking to solve, finding a satisfying assignment of variables (or not), and returning a model of the bindings.</p>
<pre>solve :: (Yices f r) =&gt; f -&gt; IO Result
solve q = do
    c &lt;- Yices.mkContext
    Yices.setTypeChecker True
    let t = convertYices q -- convert to de Bruijn form
    (g,e) &lt;- execY c t     -- build a Yices expression representing the AST
    Yices.assert c e       -- register it with Yices
    Yices.check c          -- check for satisfiability, returning the result</pre>
<h3>Related Work</h3>
<p>There&#8217;s quite a few bindings to Yices (in particular) in Haskell, but none on Hackage (at the time of writing) done as a deep EDSL (ensuring type safety and lexical scoping). The original inspiration for  the work was <a href="http://hackage.haskell.org/package/yices-easy">yices-easy</a>, which exposes a monadic, shallow DSL &#8212; and has <a href="http://mainisusuallyafunction.blogspot.com/2010/09/yices-easy-simple-sat-smt-solving-for.html">a good tutorial.</a></p>
<p><a href="http://mainisusuallyafunction.blogspot.com/2010/09/yices-easy-simple-sat-smt-solving-for.html"></a> Significant related work is by my colleague at Galois, <a href="http://corp.galois.com/levent-erkok/">Levent Erkok</a>, who simultaneously developed <a href="http://hackage.haskell.org/package/sbv">&#8220;SBV&#8221;</a>, a deep EDSL that <em>does </em>support sharing and SMT-LIB access, via heavy type class use. We&#8217;ll be sharing code.</p>
<p>The approach to embedding taken is based on the one found in<a href="http://hackage.haskell.org/package/accelerate"> accelerate</a>, which shares similarities with <a href="http://homepages.inf.ed.ac.uk/ratkey/unembedding/">Atkey, Lindley and Yallop</a>&#8216;s approach. The general idea of de Bruijn/HOAS translations was introduced by <a href="http://www.strictlypositive.org/notanum.ps.gz">McBride and McKinna</a>.</p>
<h3>Future Work</h3>
<p>At the moment, this is basically a proof of concept. Simple propositions can be solved, but its not ready for large scale problems. A few things need to be done:</p>
<ul>
<li>Support for sharing in the AST. The EDSL currently loses sharing information, duplicating terms. This isn&#8217;t feasible for large problems.</li>
<li>Operations that require certain sizes of bit vector should check those sizes (e.g. via Iavor Diatchki&#8217;s <a href="https://github.com/yav/memory-arrays/blob/master/Memory/Bit.hs#L54">type level natural support </a>for Haskell).</li>
<li>Support deriving encodings from new Haskell types into Yices types.</li>
<li>Support for lists, tuples and arrays of variables (some problems have very large numbers of variables)</li>
<li>Supporting function types.</li>
<li>Compile the AST to SMT-LIB statements (instead of Yices FFI calls), making it independent of a particular SMT solver (or solver&#8217;s license).</li>
<li>Use it on some big problems.</li>
</ul>
<p>I&#8217;ll be continuing work on this in 2011, and would welcome patches, feedback and use cases.</p>
<br /> Tagged: <a href='https://donsbot.wordpress.com/tag/design/'>design</a>, <a href='https://donsbot.wordpress.com/tag/dsl/'>dsl</a>, <a href='https://donsbot.wordpress.com/tag/language/'>language</a>, <a href='https://donsbot.wordpress.com/tag/types/'>types</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/donsbot.wordpress.com/642/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/donsbot.wordpress.com/642/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/donsbot.wordpress.com/642/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/donsbot.wordpress.com/642/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/donsbot.wordpress.com/642/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/donsbot.wordpress.com/642/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/donsbot.wordpress.com/642/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/donsbot.wordpress.com/642/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/donsbot.wordpress.com/642/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/donsbot.wordpress.com/642/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/donsbot.wordpress.com/642/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/donsbot.wordpress.com/642/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/donsbot.wordpress.com/642/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/donsbot.wordpress.com/642/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=donsbot.wordpress.com&amp;blog=6244403&amp;post=642&amp;subd=donsbot&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>https://donsbot.wordpress.com/2011/01/16/painless-np-complete-problems-an-embedded-dsl-for-smt-solving/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
	
		<media:content url="https://secure.gravatar.com/avatar/68c3dd15d6cd5d99a63113843d7e1c1b?s=96&#38;d=" medium="image">
			<media:title type="html">dons00</media:title>
		</media:content>

		<media:content url="http://donsbot.files.wordpress.com/2011/01/sat3.png?w=300" medium="image">
			<media:title type="html">Relationships between NP-complete problems</media:title>
		</media:content>

		<media:content url="http://donsbot.files.wordpress.com/2011/01/drawing.png" medium="image">
			<media:title type="html">drawing</media:title>
		</media:content>
	</item>
		<item>
		<title>Control.Monad.Inception</title>
		<link>https://donsbot.wordpress.com/2010/12/05/control-monad-inception/</link>
		<comments>https://donsbot.wordpress.com/2010/12/05/control-monad-inception/#comments</comments>
		<pubDate>Sun, 05 Dec 2010 20:01:27 +0000</pubDate>
		<dc:creator>Don Stewart</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[monad]]></category>

		<guid isPermaLink="false">http://donsbot.wordpress.com/?p=632</guid>
		<description><![CDATA[I saw Inception a few months ago. At the time I was struck by how coherent the computational environment describe in the movie was. I suspect &#8220;Inception&#8221; forms a monadic environment for computation (though not necessarily a useful one), and have been meaning to try to implement it. However, time is short, so here are [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=donsbot.wordpress.com&amp;blog=6244403&amp;post=632&amp;subd=donsbot&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I saw <a href="http://www.imdb.com/title/tt1375666/">Inception</a> a few months ago. At the time I was struck by how coherent the computational environment describe in the movie was. I suspect &#8220;Inception&#8221; forms a monadic environment for computation (though not necessarily a useful one), and have been meaning to try to implement it. However, time is short, so here are my notes from the time (August 23rd) on the semantics of Inception, in the hope that someone else will implement <strong>Control.Monad.Inception</strong>.</p>
<p>Semantics of the Inception computational environment</p>
<ul>
<li>&#8220;Dream&#8221; == thread of control == forkIO</li>
<li>A thread must stay at each level (thread group) for it not to collapse (dreamer)</li>
<li>Messages can be sent down (music) &#8211; e.g. async message passing</li>
<li>A kick exits a thread up one level (&#8220;die&#8221;) &#8211; throwTo KillThread</li>
<li>Time degrades quickly 10, 3 mins , 10 mins , 10 years &#8211; so adjust scheduler time slices based on levels</li>
<li>Groups of threads brought together by the dreamer can enter a new environment together (collaborative dreaming) &#8211; shared heap</li>
<li>Arbitrary effects are allowed, (yep, it has IO at the bottom)</li>
<li>Under sedation, you can disassociate a thread from its control stack, and it is in limbo (some &#8220;init&#8221; thread group), until it remembers.</li>
<li>Tokens are (unique) depth counters (0, many).</li>
</ul>
<p>Your challenge:</p>
<ul>
<li> Improve Claessen&#8217;s &#8220;<a href="http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.39.8039">poor man&#8217;s concurrency monad</a>&#8221; to support the Inception environment.</li>
<li>What notion of `bind` and `return` are used?</li>
<li>Show that the monad laws are satisfied.</li>
<li>import Control.Monad.Inception and win!</li>
</ul>
<p>Refer to the <a href="http://www.inceptionending.com/wp-content/uploads/2010/08/INCEPTION-infographic-v3.5.2_dwang.jpg">published analysis</a> on the use of the inception monad you need to be able to support.</p>
<br /> Tagged: <a href='https://donsbot.wordpress.com/tag/design/'>design</a>, <a href='https://donsbot.wordpress.com/tag/monad/'>monad</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/donsbot.wordpress.com/632/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/donsbot.wordpress.com/632/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/donsbot.wordpress.com/632/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/donsbot.wordpress.com/632/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/donsbot.wordpress.com/632/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/donsbot.wordpress.com/632/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/donsbot.wordpress.com/632/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/donsbot.wordpress.com/632/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/donsbot.wordpress.com/632/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/donsbot.wordpress.com/632/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/donsbot.wordpress.com/632/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/donsbot.wordpress.com/632/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/donsbot.wordpress.com/632/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/donsbot.wordpress.com/632/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=donsbot.wordpress.com&amp;blog=6244403&amp;post=632&amp;subd=donsbot&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>https://donsbot.wordpress.com/2010/12/05/control-monad-inception/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="https://secure.gravatar.com/avatar/68c3dd15d6cd5d99a63113843d7e1c1b?s=96&#38;d=" medium="image">
			<media:title type="html">dons00</media:title>
		</media:content>
	</item>
		<item>
		<title>Hackage, Cabal and the Haskell Platform: The Second Year</title>
		<link>https://donsbot.wordpress.com/2010/10/01/hackage-cabal-and-the-haskell-platform-the-second-year/</link>
		<comments>https://donsbot.wordpress.com/2010/10/01/hackage-cabal-and-the-haskell-platform-the-second-year/#comments</comments>
		<pubDate>Fri, 01 Oct 2010 13:47:33 +0000</pubDate>
		<dc:creator>Don Stewart</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[cabal]]></category>
		<category><![CDATA[community]]></category>
		<category><![CDATA[package]]></category>

		<guid isPermaLink="false">http://donsbot.wordpress.com/?p=622</guid>
		<description><![CDATA[The Haskell Implementors Workshop was held in Baltimore, Oct 1, 2010. Duncan Coutts from Well-Typed and I presented a status report on the Haskell distribution infrastructure: The Haskell Platform Hackage Cabal You can read the slides as PDF here, or online: ﻿The amount of freely available Haskell code has grown exponentially in the past two [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=donsbot.wordpress.com&amp;blog=6244403&amp;post=622&amp;subd=donsbot&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img class="alignright" title="Haskell Platform" src="http://hackage.haskell.org/platform/images/Haskell-Logo-Download-Summer.png" alt="" width="128" height="128" />The <a href="http://haskell.org/haskellwiki/HaskellImplementorsWorkshop/2010">Haskell Implementors Workshop </a> was held in Baltimore, Oct 1, 2010. Duncan Coutts from Well-Typed and I presented a status report on the Haskell distribution infrastructure:</p>
<ul>
<li><a href="http://haskell.org/platform">The Haskell Platform</a></li>
<li><a href="http://hackage.haskell.org">Hackage</a></li>
<li>Cabal</li>
</ul>
<p>You can read the slides <a href="http://www.galois.com/~dons/talks/hiw-hackage-y2.pdf">as PDF here</a>, or online:</p>
<iframe class="scribd_iframe_embed" src="http://www.scribd.com/embeds/38533401/content?start_page=1&view_mode=slideshow&access_key=key-2jy10cu25y963pkp5831" data-auto-height="true" scrolling="no" id="scribd_38533401" width="100%" height="500" frameborder="0"></iframe>
<div style="font-size:10px;text-align:center;width:100%"><a href="http://www.scribd.com/doc/38533401">View this document on Scribd</a></div>
<blockquote><p>﻿The amount of freely available Haskell code has grown exponentially in the past<br />
two years as Hackage and Cabal have come online. Managing millions of Haskell<br />
code, partitioned thousands of interdependent packages is a serious engineering<br />
challenge that has received little attention from the language research community.<br />
Meanwhile, new adopters of Haskell struggle to deal with the sheer number of<br />
libraries and tools now available.</p>
<p>One pragmatic approach to managing this web is the Haskell Platform (HP), a<br />
project to build a blessed, comprehensive set of libraries meeting objective<br />
quality control criteria, and in doing so make expert recommendations on which<br />
packages to use. In its first six weeks of operation the HP had over forty<br />
thousand downloads.</p>
<p>The challenge with such a project is to manage the many conflict constraints<br />
for diversity, coverage, and quality when assembling the package set. This talk<br />
will outline the state of the Haskell Platform, the technical approaches taken<br />
to build it, and the roadmap ahead.</p></blockquote>
<br /> Tagged: <a href='https://donsbot.wordpress.com/tag/cabal/'>cabal</a>, <a href='https://donsbot.wordpress.com/tag/community/'>community</a>, <a href='https://donsbot.wordpress.com/tag/package/'>package</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/donsbot.wordpress.com/622/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/donsbot.wordpress.com/622/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/donsbot.wordpress.com/622/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/donsbot.wordpress.com/622/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/donsbot.wordpress.com/622/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/donsbot.wordpress.com/622/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/donsbot.wordpress.com/622/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/donsbot.wordpress.com/622/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/donsbot.wordpress.com/622/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/donsbot.wordpress.com/622/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/donsbot.wordpress.com/622/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/donsbot.wordpress.com/622/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/donsbot.wordpress.com/622/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/donsbot.wordpress.com/622/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=donsbot.wordpress.com&amp;blog=6244403&amp;post=622&amp;subd=donsbot&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>https://donsbot.wordpress.com/2010/10/01/hackage-cabal-and-the-haskell-platform-the-second-year/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="https://secure.gravatar.com/avatar/68c3dd15d6cd5d99a63113843d7e1c1b?s=96&#38;d=" medium="image">
			<media:title type="html">dons00</media:title>
		</media:content>

		<media:content url="http://hackage.haskell.org/platform/images/Haskell-Logo-Download-Summer.png" medium="image">
			<media:title type="html">Haskell Platform</media:title>
		</media:content>
	</item>
		<item>
		<title>Practical Haskell: scripting with types</title>
		<link>https://donsbot.wordpress.com/2010/08/17/practical-haskell/</link>
		<comments>https://donsbot.wordpress.com/2010/08/17/practical-haskell/#comments</comments>
		<pubDate>Wed, 18 Aug 2010 04:13:24 +0000</pubDate>
		<dc:creator>Don Stewart</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[language]]></category>
		<category><![CDATA[monad]]></category>
		<category><![CDATA[types]]></category>

		<guid isPermaLink="false">http://donsbot.wordpress.com/?p=596</guid>
		<description><![CDATA[I had the pleasure to give a new talk today, on design in functional programming &#8212; types, abstractions and monads &#8212; using the motivating example of scripting. The slides are below and a PDF version is available. ﻿﻿Shell scripts are often a quick, dirty way to get the job done. You glue together external tools, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=donsbot.wordpress.com&amp;blog=6244403&amp;post=596&amp;subd=donsbot&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I had the pleasure to give a new talk today, on design in functional programming &#8212; types, abstractions and monads &#8212; using the motivating example of scripting. The slides are below and <a href="http://www.galois.com/~dons/talks/semicolon.pdf">a PDF version</a> is available.</p>
<iframe class="scribd_iframe_embed" src="http://www.scribd.com/embeds/36045849/content?start_page=1&view_mode=slideshow&access_key=key-sac3ywxj2y3h2hltwjw" data-auto-height="true" scrolling="no" id="scribd_36045849" width="100%" height="500" frameborder="0"></iframe>
<div style="font-size:10px;text-align:center;width:100%"><a href="http://www.scribd.com/doc/36045849">View this document on Scribd</a></div>
<blockquote><p>﻿﻿Shell scripts are often a quick, dirty way to get the job done. You glue<br />
together external tools, maybe do a little error checking and process all data<br />
as strings. This is great for some very simple problems but as requirements<br />
change and more is demanded from the code shell scripts become unwieldy and<br />
fragile. When they get large, they become slow and difficult to maintain. If<br />
you need to write robust code then shell is not the way to go.</p>
<p>In this talk at an alternative: how to use Haskell as a type checked and<br />
natively compiled language for scripting tasks. By refining the semantics of<br />
the problem domain, employing abstraction, we produce shorter and more robust<br />
code, that is more maintainable and scalable.</p></blockquote>
<br /> Tagged: <a href='https://donsbot.wordpress.com/tag/design/'>design</a>, <a href='https://donsbot.wordpress.com/tag/language/'>language</a>, <a href='https://donsbot.wordpress.com/tag/monad/'>monad</a>, <a href='https://donsbot.wordpress.com/tag/types/'>types</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/donsbot.wordpress.com/596/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/donsbot.wordpress.com/596/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/donsbot.wordpress.com/596/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/donsbot.wordpress.com/596/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/donsbot.wordpress.com/596/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/donsbot.wordpress.com/596/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/donsbot.wordpress.com/596/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/donsbot.wordpress.com/596/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/donsbot.wordpress.com/596/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/donsbot.wordpress.com/596/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/donsbot.wordpress.com/596/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/donsbot.wordpress.com/596/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/donsbot.wordpress.com/596/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/donsbot.wordpress.com/596/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=donsbot.wordpress.com&amp;blog=6244403&amp;post=596&amp;subd=donsbot&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>https://donsbot.wordpress.com/2010/08/17/practical-haskell/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
	
		<media:content url="https://secure.gravatar.com/avatar/68c3dd15d6cd5d99a63113843d7e1c1b?s=96&#38;d=" medium="image">
			<media:title type="html">dons00</media:title>
		</media:content>
	</item>
		<item>
		<title>Haskell Platform 2010.2.0.0 is live!</title>
		<link>https://donsbot.wordpress.com/2010/07/22/haskell-platform-2010-2-0-0-is-live/</link>
		<comments>https://donsbot.wordpress.com/2010/07/22/haskell-platform-2010-2-0-0-is-live/#comments</comments>
		<pubDate>Fri, 23 Jul 2010 00:07:39 +0000</pubDate>
		<dc:creator>Don Stewart</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[community]]></category>
		<category><![CDATA[ghc]]></category>
		<category><![CDATA[hackage]]></category>
		<category><![CDATA[package]]></category>

		<guid isPermaLink="false">http://donsbot.wordpress.com/?p=592</guid>
		<description><![CDATA[We&#8217;re pleased to announce the fifth release of the Haskell Platform: a single, standard Haskell distribution for everyone. The specification, along with installers (including Windows, Apple and Unix installers for a full Haskell environment) are available. The Haskell Platform is a single, standard Haskell distribution for every system, in the form of a blessed library and tool [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=donsbot.wordpress.com&amp;blog=6244403&amp;post=592&amp;subd=donsbot&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>We&#8217;re pleased to announce the fifth release of <a href="http://hackage.haskell.org.nyud.net/platform/">the Haskell Platform</a>: a single, standard Haskell distribution for everyone.</p>
<p><a href="http://hackage.haskell.org.nyud.net/platform/"><img class="aligncenter" title="Download Haskell" src="http://hackage.haskell.org/platform/icons/button-100.png" alt="" width="193" height="75" /></a></p>
<p>The <a href="http://hackage.haskell.org/platform/2010.2.0.0/haskell-platform.cabal">specification</a>, along with installers (including Windows, Apple and<br />
Unix installers for a full Haskell environment) are available.</p>
<p>The Haskell Platform is a single, standard Haskell distribution for every system, in the form of a blessed library and tool suite for Haskell distilled from the thousands of libraries on Hackage, along with installers for a wide variety of systems. It saves developers work picking and choosing the best Haskell libraries and tools to use for a task.</p>
<p>When you install the Haskell Platform, you get the latest stable compiler, an expanded set of core libraries, additional development tools, and cabal-install – so you can download anything else you need from Hackage.</p>
<p>What you get<a href="http://hackage.haskell.org/platform/contents.html"> is specified here</a>.</p>
<p>&#8211; The Platform Infrastructure Team</p>
<br /> Tagged: <a href='https://donsbot.wordpress.com/tag/community/'>community</a>, <a href='https://donsbot.wordpress.com/tag/ghc/'>ghc</a>, <a href='https://donsbot.wordpress.com/tag/hackage/'>hackage</a>, <a href='https://donsbot.wordpress.com/tag/package/'>package</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/donsbot.wordpress.com/592/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/donsbot.wordpress.com/592/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/donsbot.wordpress.com/592/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/donsbot.wordpress.com/592/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/donsbot.wordpress.com/592/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/donsbot.wordpress.com/592/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/donsbot.wordpress.com/592/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/donsbot.wordpress.com/592/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/donsbot.wordpress.com/592/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/donsbot.wordpress.com/592/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/donsbot.wordpress.com/592/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/donsbot.wordpress.com/592/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/donsbot.wordpress.com/592/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/donsbot.wordpress.com/592/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=donsbot.wordpress.com&amp;blog=6244403&amp;post=592&amp;subd=donsbot&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>https://donsbot.wordpress.com/2010/07/22/haskell-platform-2010-2-0-0-is-live/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="https://secure.gravatar.com/avatar/68c3dd15d6cd5d99a63113843d7e1c1b?s=96&#38;d=" medium="image">
			<media:title type="html">dons00</media:title>
		</media:content>

		<media:content url="http://hackage.haskell.org/platform/icons/button-100.png" medium="image">
			<media:title type="html">Download Haskell</media:title>
		</media:content>
	</item>
		<item>
		<title>Engineering Large Projects in a Functional Language</title>
		<link>https://donsbot.wordpress.com/2010/07/11/engineering-large-projects-in-a-functional-language/</link>
		<comments>https://donsbot.wordpress.com/2010/07/11/engineering-large-projects-in-a-functional-language/#comments</comments>
		<pubDate>Sun, 11 Jul 2010 19:21:19 +0000</pubDate>
		<dc:creator>Don Stewart</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://donsbot.wordpress.com/?p=587</guid>
		<description><![CDATA[I had the opportunity to speak at DevNation on July 10th in Portland, and gave the following talk, an updated version of Galois&#8217; collective experiences developing Haskell projects over the past decade. You can download the .pdf. Abstract Galois has been building software systems in Haskell for the past decade. This talk describes some of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=donsbot.wordpress.com&amp;blog=6244403&amp;post=587&amp;subd=donsbot&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I had the opportunity to speak at <a href="http://devnation.us/">DevNation</a> on July 10th in Portland, and gave the following talk, an updated version of Galois&#8217; collective experiences developing Haskell projects over the past decade. You can <a href="http://www.galois.com/~dons/talks/decade-white.pdf">download the .pdf</a>.</p>
<iframe class="scribd_iframe_embed" src="http://www.scribd.com/embeds/34156902/content?start_page=1&view_mode=slideshow&access_key=key-pt2sizewyou64z48y0k" data-auto-height="true" scrolling="no" id="scribd_34156902" width="100%" height="500" frameborder="0"></iframe>
<div style="font-size:10px;text-align:center;width:100%"><a href="http://www.scribd.com/doc/34156902">View this document on Scribd</a></div>
<p style="padding-left:30px;"><strong>Abstract</strong></p>
<p style="padding-left:30px;"><em>Galois has been building software systems in Haskell for the past decade. This talk describes some of what we’ve learned about in-the-large, commercial Haskell programming in that time. I&#8217;ll look at when and where we use Haskell. At correctness, productivity, scalabilty, maintainability, and what language features we like: types, purity, types, abstractions, types, concurrency, types!</em></p>
<p style="padding-left:30px;"><em>We&#8217;ll also look at the Haskell toolchain: FFI, HPC, Cabal, compiler, libraries, build systems, etc, and being a commercial entity in a largely open source community.</em></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/donsbot.wordpress.com/587/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/donsbot.wordpress.com/587/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/donsbot.wordpress.com/587/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/donsbot.wordpress.com/587/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/donsbot.wordpress.com/587/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/donsbot.wordpress.com/587/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/donsbot.wordpress.com/587/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/donsbot.wordpress.com/587/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/donsbot.wordpress.com/587/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/donsbot.wordpress.com/587/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/donsbot.wordpress.com/587/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/donsbot.wordpress.com/587/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/donsbot.wordpress.com/587/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/donsbot.wordpress.com/587/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=donsbot.wordpress.com&amp;blog=6244403&amp;post=587&amp;subd=donsbot&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>https://donsbot.wordpress.com/2010/07/11/engineering-large-projects-in-a-functional-language/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="https://secure.gravatar.com/avatar/68c3dd15d6cd5d99a63113843d7e1c1b?s=96&#38;d=" medium="image">
			<media:title type="html">dons00</media:title>
		</media:content>
	</item>
		<item>
		<title>ghc-gc-tune: Tuning Haskell GC settings for fun and profit</title>
		<link>https://donsbot.wordpress.com/2010/07/05/ghc-gc-tune-tuning-haskell-gc-settings-for-fun-and-profit/</link>
		<comments>https://donsbot.wordpress.com/2010/07/05/ghc-gc-tune-tuning-haskell-gc-settings-for-fun-and-profit/#comments</comments>
		<pubDate>Tue, 06 Jul 2010 00:43:28 +0000</pubDate>
		<dc:creator>Don Stewart</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[community]]></category>
		<category><![CDATA[gc]]></category>
		<category><![CDATA[ghc]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://donsbot.wordpress.com/?p=578</guid>
		<description><![CDATA[Inspired by a comment by Simon Marlow on Stack Overflow, about the time and space tradeoffs we make with garbage collection, particularly with a generational GCs, I wrote a small program, ghc-gc-tune, to traverse the garbage collector variable space, to see the relationship between settings and program performance. Given a program, it will show you an [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=donsbot.wordpress.com&amp;blog=6244403&amp;post=578&amp;subd=donsbot&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Inspired by <a href="http://stackoverflow.com/questions/3171922/ghcs-rts-options-for-garbage-collection/3172704#3172704">a comment by Simon Marlow</a> on Stack Overflow, about the time and space tradeoffs we make with garbage collection, particularly with a generational GCs, I wrote a small program, <a href="http://hackage.haskell.org/package/ghc-gc-tune"><strong>ghc-gc-tune</strong></a>, to traverse the garbage collector variable space, to see the relationship between settings and program performance. Given a program, it will show you an (optionally interactive) graph of how -A and -H flags to the garbage collector affect performance.</p>
<p>Previously I&#8217;ve had good success exploring multi-variable spaces for optimizations with GAs in Haskell, to <a href="http://donsbot.wordpress.com/2009/03/09/evolving-faster-haskell-programs/">find strictness flags</a> and <a href="http://donsbot.wordpress.com/2010/03/01/evolving-faster-haskell-programs-now-with-llvm/">LLVM flag settings</a>, so I was keen to see what the GC space looked like. In this initial GC search, however, I don&#8217;t use a GA, instead just measuring time as two variables change over the entire space.</p>
<p>Here&#8217;s an example for the <a href="http://shootout.alioth.debian.org/u64q/program.php?test=binarytrees&amp;lang=ghc&amp;id=1">binary-trees</a> language shootout benchmark, where the GHC default settings are known to be suboptimal (the benchmark disallows changes to the default runtime GC settings):</p>
<div class="wp-caption aligncenter" style="width: 615px"><a href="http://i.imgur.com/m2yKr.png"><img class=" " title="Binary Trees" src="http://i.imgur.com/m2yKr.png" alt="" width="605" height="404" /></a><p class="wp-caption-text">Running time of the binary-trees benchmark as -A and -H vary</p></div>
<p>The flags we use are:</p>
<ul>
<li>-A, the size of the initial thread allocation area for the youngest generation.</li>
<li>-H, the suggested overall heap size</li>
</ul>
<p>ghc-gc-tune, in the style of <a href="http://hackage.haskell.org/package/ghc-core">ghc-core</a>, wraps a compiled Haskell program, and runs it with varying values of -A and -H, recording various statistics about the program. The output can be rendered interactively, or to png, pdf or svg. It would augment use of <a href="http://www.haskell.org/haskellwiki/Hp2any#hp2any-manager">heap profiling</a>, <a href="http://research.microsoft.com/en-us/projects/threadscope/">ThreadScope </a>and ghc-core for analyzing and improving Haskell program behavior.</p>
<p>In this case, ghc-gc-tune recommends ﻿the somewhat surprising ﻿-A64k -H32M, and binary-trees runs in 1.12s at N=16, while for the default GC settings it completes in 1.56s. So ghc-gc-tune found settings that improved performance by 28%.  Nice.</p>
<p>I already knew that a <em>large </em>-A setting helped this program (corresponding to the broad plateau for large -A values in the above graph), however, I was surprised to see the best result was with a very small -A setting, and medium sized -H setting, resulting in only 5% of time spent in GC, and 36M total allocated &#8212; the narrow valley on the far side of the graph. Very interesting! And is that my L2 cache in the square at x= 2M, y = 2M? Sure looks like it.</p>
<p>Here&#8217;s a video of the same graph in the tool&#8217;s interactive mode (without any -t flag):</p>
<div class='embed-vimeo' style='text-align:center;'><iframe src='http://player.vimeo.com/video/13112184' width='400' height='300' frameborder='0'></iframe></div>
<p>Currently, the sampling is vary simplistic, with a fixed set of logscale values taken. A clever sampling algorithm would measure the heap used in the default case, and compute a range based on that, possibly with cutoffs for very pessimistic GC flags.</p>
<p>Another example: <a href="http://shootout.alioth.debian.org/u64q/performance.php?test=pidigits">pidigits</a>, with what I would consider far more typical behavior. Though again, a surprisingly small -A setting does well, and there&#8217;s an interesting pathological result with extremely large -H and very small -A settings.</p>
<div class="wp-caption aligncenter" style="width: 586px"><a href="http://i.imgur.com/Nrr8B.png"><img title="PiDigits GC Space" src="http://i.imgur.com/Nrr8B.png" alt="" width="576" height="432" /></a><p class="wp-caption-text">PiDigiits GC space</p></div>
<p>You can get ghc-gc-tune from Hackage, via cabal, and note that it requires gnuplot installed. Let me know if you find it useful, and I welcome patches!</p>
<p>Future work will be to graph the Z axis as space, instead of time (so we can find GC settings that minimize the footprint), as well as adding other variables (such as parallel GC settings, and varying the number of generations).</p>
<br /> Tagged: <a href='https://donsbot.wordpress.com/tag/community/'>community</a>, <a href='https://donsbot.wordpress.com/tag/gc/'>gc</a>, <a href='https://donsbot.wordpress.com/tag/ghc/'>ghc</a>, <a href='https://donsbot.wordpress.com/tag/performance/'>performance</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/donsbot.wordpress.com/578/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/donsbot.wordpress.com/578/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/donsbot.wordpress.com/578/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/donsbot.wordpress.com/578/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/donsbot.wordpress.com/578/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/donsbot.wordpress.com/578/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/donsbot.wordpress.com/578/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/donsbot.wordpress.com/578/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/donsbot.wordpress.com/578/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/donsbot.wordpress.com/578/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/donsbot.wordpress.com/578/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/donsbot.wordpress.com/578/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/donsbot.wordpress.com/578/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/donsbot.wordpress.com/578/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=donsbot.wordpress.com&amp;blog=6244403&amp;post=578&amp;subd=donsbot&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>https://donsbot.wordpress.com/2010/07/05/ghc-gc-tune-tuning-haskell-gc-settings-for-fun-and-profit/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
		<media:content url="https://secure.gravatar.com/avatar/68c3dd15d6cd5d99a63113843d7e1c1b?s=96&#38;d=" medium="image">
			<media:title type="html">dons00</media:title>
		</media:content>

		<media:content url="http://i.imgur.com/m2yKr.png" medium="image">
			<media:title type="html">Binary Trees</media:title>
		</media:content>

		<media:content url="http://i.imgur.com/Nrr8B.png" medium="image">
			<media:title type="html">PiDigits GC Space</media:title>
		</media:content>
	</item>
		<item>
		<title>Popular Haskell Packages: Q2 2010 report</title>
		<link>https://donsbot.wordpress.com/2010/06/30/popular-haskell-packages-q2-2010-report/</link>
		<comments>https://donsbot.wordpress.com/2010/06/30/popular-haskell-packages-q2-2010-report/#comments</comments>
		<pubDate>Wed, 30 Jun 2010 22:02:36 +0000</pubDate>
		<dc:creator>Don Stewart</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[cabal]]></category>
		<category><![CDATA[community]]></category>
		<category><![CDATA[hackage]]></category>
		<category><![CDATA[package]]></category>

		<guid isPermaLink="false">http://donsbot.wordpress.com/?p=573</guid>
		<description><![CDATA[Here is some data on downloads of Haskell libraries and apps on Hackage, for the first half of 2010. Hackage is the central repository of open source Haskell libraries and tools. Once they install the Haskell Platform, users get more libraries from Hackage, via “cabal install”. Headlines May was the most popular month for Hackage ever, breaking [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=donsbot.wordpress.com&amp;blog=6244403&amp;post=573&amp;subd=donsbot&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Here is some data on downloads of Haskell libraries and apps on <a href="http://hackage.haskell.org">Hackage</a>, for the first half of 2010.</p>
<p><img class="alignright" title="Hackage Graph" src="http://www.galois.com/~dons/images/hackage-circo-thumb.png" alt="The Hackage dependency graph" width="200" height="230" /></p>
<p>Hackage is the central repository of open source Haskell libraries and tools. Once they install the <a href="http://haskell.org/platform">Haskell Platform</a>, users get more libraries from Hackage, via “cabal install”.</p>
<p><strong>Headlines</strong></p>
<p>May was the most popular month for Hackage ever, breaking 150k downloads in a single month for the first time.</p>
<p>The <a href="http://donsbot.wordpress.com/2010/05/31/there-are-a-hell-of-a-lot-of-haskell-libraries-now-what-are-we-going-to-do-about-it/">2000th Haskell package</a> was released on April 16.</p>
<p>Total downloads on Hackage since 2006 have passed 2.4 million, with 780 thousand downloads in 2010 so far (double the total from the same time in 2009).</p>
<p><strong>Totals</strong></p>
<p>Total cabal packages: <strong>2182</strong><strong>.</strong> (+ 208 in Q2).</p>
<p>Total contributing developers: <strong>575 </strong>(42 new developers in Q2)</p>
<p>90 day moving average: <strong>12 packages per day uploaded</strong>.</p>
<p>Total downloads from Hackage 2007-present: <strong>2.42 million</strong></p>
<p>Average monthly downloads in 2010: <strong>130 thousand.</strong></p>
<p><strong>Top of the Pops</strong></p>
<p>The top 15 most popular libraries in the first half of 2010 were:</p>
<ol>
<li>HTTP</li>
<li>parsec (+1)</li>
<li>zlib (-1)</li>
<li>binary (+1)</li>
<li>network (+2)</li>
<li>utf8-string (-2)</li>
<li>Cabal (+1)</li>
<li>QuickCheck (-2)</li>
<li>mtl (+1)</li>
<li>haskell-src-exts (-1)</li>
<li>regex-base</li>
<li>deepseq (+6)</li>
<li>ghc-paths (+2)</li>
<li>hslogger (+6)</li>
<li>regex-posix (-2)</li>
</ol>
<p>Top 15 most popular applications in the first half of 2010:</p>
<ol>
<li>cabal-install</li>
<li>xmonad</li>
<li>haddock (+1)</li>
<li>cpphs (-1)</li>
<li>happy</li>
<li>darcs (+1)</li>
<li>alex (+1)</li>
<li>hscolour (-2)</li>
<li>pandoc</li>
<li>hlint</li>
<li>leksah</li>
<li>xmobar</li>
<li>yi</li>
<li>hint</li>
<li>agda</li>
</ol>
<p><strong>Honorable Mentions</strong></p>
<ul>
<li>The Galois xml library was more popular in the first half of 2010 than HaXml, dethroning HaXml for the first time.</li>
<li>text has made it into the top 30 libraries</li>
<li>HDBC continues to be the most popular database library</li>
<li>vector has almost surpassed array in downloads (array is part of the Haskell Platform though)</li>
<li>wxHaskell is still more popular than gtk2hs on Hackage,  though gtk2hs has almost caught up.</li>
</ul>
<p>You can read <a href="http://code.haskell.org/~dons/hackage/Jun-2010/Jun-2010.csv">all the 2010 data for your favorite packages</a>, and <a href="http://code.haskell.org/~dons/hackage/Jun-2010/popular.txt">ranked by 2010 popularity.</a></p>
<p><strong>Top Libraries by Category</strong></p>
<ul>
<li><strong>Networking: </strong>HTTP, network, network-bytestring, curl</li>
<li><strong>Parsing: </strong>parsec, polyparse, attoparsec</li>
<li><strong>Compression: </strong>zlib, zip-archive</li>
<li><strong>Binary formats: </strong>binary, cereal</li>
<li><strong>Text formats: </strong>utf8-string, text, dataenc</li>
<li><strong>Markup: </strong>pandoc, xhtml, tagsoup, html</li>
<li><strong>JSON: </strong>json</li>
<li><strong>Atom/RSS</strong>: feed</li>
<li><strong>XML: </strong>xml, HaXml, hexpat</li>
<li><strong>Web services</strong>:  happstack, snap</li>
<li><strong>GUIs</strong>: wxHaskell, gtk2hs</li>
<li><strong>Graphics</strong>: SDL, cairo, gd</li>
<li><strong>Templates</strong>: HStringTemplate</li>
<li><strong>Testing: </strong>QuickCheck, HUnit, testpack, hpc</li>
<li><strong>Control: </strong>mtl, transformers, monads-fd</li>
<li><strong>Languages: </strong>haskell-src-exts, haskell-src, ﻿HJavaScript</li>
<li><strong>Regexes: </strong>regex-{base,posix,compat,tdfa}, pcre-light</li>
<li><strong>Logging: </strong>hslogger</li>
<li><strong>Generics: </strong>uniplate, syb-with-class, syb</li>
<li><strong>3D: </strong>OpenGL</li>
<li><strong>Edit history: </strong>haskeline</li>
<li><strong>Concurrency and parallelism: </strong>parallel, stm</li>
<li><strong>Databases: </strong>HDBC</li>
<li><strong>Arrays</strong>: array, vector, hmatrix</li>
<li><strong>Hashing</strong>: pureMD5, SHA</li>
<li><strong>Data structures</strong>: containers, fingertree, dlist</li>
<li><strong>Science</strong>:  statistics</li>
<li><strong>Benchmarking</strong>: criterion</li>
<li><strong>Storage</strong>: hs3</li>
</ul>
<p>Is there anything else you see in the data?</p>
<br /> Tagged: <a href='https://donsbot.wordpress.com/tag/cabal/'>cabal</a>, <a href='https://donsbot.wordpress.com/tag/community/'>community</a>, <a href='https://donsbot.wordpress.com/tag/hackage/'>hackage</a>, <a href='https://donsbot.wordpress.com/tag/package/'>package</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/donsbot.wordpress.com/573/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/donsbot.wordpress.com/573/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/donsbot.wordpress.com/573/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/donsbot.wordpress.com/573/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/donsbot.wordpress.com/573/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/donsbot.wordpress.com/573/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/donsbot.wordpress.com/573/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/donsbot.wordpress.com/573/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/donsbot.wordpress.com/573/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/donsbot.wordpress.com/573/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/donsbot.wordpress.com/573/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/donsbot.wordpress.com/573/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/donsbot.wordpress.com/573/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/donsbot.wordpress.com/573/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=donsbot.wordpress.com&amp;blog=6244403&amp;post=573&amp;subd=donsbot&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>https://donsbot.wordpress.com/2010/06/30/popular-haskell-packages-q2-2010-report/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="https://secure.gravatar.com/avatar/68c3dd15d6cd5d99a63113843d7e1c1b?s=96&#38;d=" medium="image">
			<media:title type="html">dons00</media:title>
		</media:content>

		<media:content url="http://www.galois.com/~dons/images/hackage-circo-thumb.png" medium="image">
			<media:title type="html">Hackage Graph</media:title>
		</media:content>
	</item>
		<item>
		<title>Open Source Bridge Talk: Multicore Haskell Now</title>
		<link>https://donsbot.wordpress.com/2010/06/01/open-source-bridge-talk-multicore-haskell-now/</link>
		<comments>https://donsbot.wordpress.com/2010/06/01/open-source-bridge-talk-multicore-haskell-now/#comments</comments>
		<pubDate>Wed, 02 Jun 2010 03:13:06 +0000</pubDate>
		<dc:creator>Don Stewart</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[parallel]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://donsbot.wordpress.com/?p=556</guid>
		<description><![CDATA[In June I had the opportunity to talk about approaches to parallel programming in Haskell at Open Source Bridge: &#8220;a new conference for developers working with open source technologies and for people interested in learning the open source way.&#8221; Here are the slides (::PDF), and the source that accompanied the tutorial: The abstract for  the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=donsbot.wordpress.com&amp;blog=6244403&amp;post=556&amp;subd=donsbot&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In June I had the opportunity to talk about approaches to parallel programming in Haskell at <a href="http://opensourcebridge.org/">Open Source Bridge</a>: &#8220;a new conference for developers working with open source technologies and for people interested in learning the open source way.&#8221;</p>
<p>Here are <a href="http://www.galois.com/~dons/talks/osbridge-2010-multicore.pdf"><strong>the slides</strong></a> (::PDF), and <a href="http://www.galois.com/~dons/talks/DEFUN-Multicore-source.tar.gz"><strong>the source</strong></a> that accompanied the tutorial:</p>
<iframe class="scribd_iframe_embed" src="http://www.scribd.com/embeds/32353172/content?start_page=1&view_mode=slideshow&access_key=key-1h1ykhdip1knilfpukeg" data-auto-height="true" scrolling="no" id="scribd_32353172" width="100%" height="500" frameborder="0"></iframe>
<div style="font-size:10px;text-align:center;width:100%"><a href="http://www.scribd.com/doc/32353172">View this document on Scribd</a></div>
<p>The abstract for  <a href="http://opensourcebridge.org/sessions/326">the session</a>:</p>
<blockquote><p>﻿﻿Haskell is a functional language built for parallel and concurrent programming. You can take an off-the-shelf copy of GHC and write high performance parallel programs right now. This tutorial will teach you how to exploit parallelism through Haskell on your commodity multicore machine, to make your code faster. We will introduce key parallel programming models, as implemented in Haskell, including:</p>
<ul>
<li>semi-explicit parallelism via sparks</li>
<li>explicit parallelism via threads and shared memory</li>
<li>software transactional memory</li>
</ul>
<p>and look at how to build faster programs using these abstractions. We will also look at the engineering considerations when writing parallel programs, and the tools Haskell provides for debugging and reasoning about parallel programs.</p>
<p>This is a hands on tutorial session: bring your laptops, there will be code!</p></blockquote>
<br /> Tagged: <a href='https://donsbot.wordpress.com/tag/parallel/'>parallel</a>, <a href='https://donsbot.wordpress.com/tag/performance/'>performance</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/donsbot.wordpress.com/556/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/donsbot.wordpress.com/556/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/donsbot.wordpress.com/556/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/donsbot.wordpress.com/556/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/donsbot.wordpress.com/556/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/donsbot.wordpress.com/556/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/donsbot.wordpress.com/556/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/donsbot.wordpress.com/556/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/donsbot.wordpress.com/556/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/donsbot.wordpress.com/556/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/donsbot.wordpress.com/556/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/donsbot.wordpress.com/556/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/donsbot.wordpress.com/556/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/donsbot.wordpress.com/556/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=donsbot.wordpress.com&amp;blog=6244403&amp;post=556&amp;subd=donsbot&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>https://donsbot.wordpress.com/2010/06/01/open-source-bridge-talk-multicore-haskell-now/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="https://secure.gravatar.com/avatar/68c3dd15d6cd5d99a63113843d7e1c1b?s=96&#38;d=" medium="image">
			<media:title type="html">dons00</media:title>
		</media:content>
	</item>
		<item>
		<title>There are a hell of a lot of Haskell libraries now. What are we going to do about it?</title>
		<link>https://donsbot.wordpress.com/2010/05/31/there-are-a-hell-of-a-lot-of-haskell-libraries-now-what-are-we-going-to-do-about-it/</link>
		<comments>https://donsbot.wordpress.com/2010/05/31/there-are-a-hell-of-a-lot-of-haskell-libraries-now-what-are-we-going-to-do-about-it/#comments</comments>
		<pubDate>Mon, 31 May 2010 23:02:14 +0000</pubDate>
		<dc:creator>Don Stewart</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[cabal]]></category>
		<category><![CDATA[community]]></category>
		<category><![CDATA[ghc]]></category>
		<category><![CDATA[hackage]]></category>
		<category><![CDATA[package]]></category>
		<category><![CDATA[summer of code]]></category>

		<guid isPermaLink="false">http://donsbot.wordpress.com/?p=545</guid>
		<description><![CDATA[The Haskell community has reached a bit of a milestone: there are now more than 2000 open source libraries for Haskell on Hackage! However, with this also comes a problem: how do you work out which library to use? (Without learning one Haskell library a day for the next 6 years?) Which ones are robust, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=donsbot.wordpress.com&amp;blog=6244403&amp;post=545&amp;subd=donsbot&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The Haskell community has reached a bit of a milestone: there are now more than 2000 open source libraries for Haskell on <a href="http://hackage.haskell.org">Hackage</a>! However, with this also comes a problem: how do you work out which library to use? (<em>Without learning one Haskell library a day for the next 6 years?)</em> Which ones are robust, and supported, and which ones aren&#8217;t? This isn&#8217;t a new problem in open source: the Perl community has faced it with CPAN for a decade or more. Now Haskell is in the same situation.</p>
<p>In fact, it&#8217;s kind of startling to look back: in 2006, there were only a handful of open source Haskell libraries for developers to use in their projects (just HDBC, zlib, libxml, Crypto&#8230;). Today, there are 2121 (more by the time you read this) libraries for Haskell, available as source on <a href="http://hackage.haskell.org">http://hackage.haskell.org</a> (only a &#8220;cabal install&#8221; away), and often 100s of Haskell libraries i<a href="http://pkg-haskell.alioth.debian.org/cgi-bin/pet.cgi">n binary form on your favorite distro</a>. You can even <a href="http://twitter.com/Hackage">follow the package flood on Twitter</a>.</p>
<p>Here&#8217;s what the growth in available Haskell libraries over the last 4 years looks like:</p>
<p style="text-align:center;"><a href="http://donsbot.files.wordpress.com/2010/05/hackage-june-2010.png"><img class="aligncenter size-full wp-image-546" title="hackage-june-2010" src="http://donsbot.files.wordpress.com/2010/05/hackage-june-2010.png?w=575" alt=""   /></a></p>
<p style="text-align:left;">We passed 1000 libraries in early 2009, and doubled that a year later.</p>
<p style="text-align:left;">So this is great for the Haskell dev community. In some areas, like database interfacing, we&#8217;ve gone from a single option (<a href="http://hackage.haskell.org/package/HDBC">HDBC</a>) to a full range, including new stuff like, uh, well, <a href="http://hackage.haskell.org/package/cassandra-thrift">Cassandra</a>, <a href="http://hackage.haskell.org/package/CouchDB">CouchDB</a>, <a href="http://hackage.haskell.org/package/hSimpleDB">Amazon SimpleDB</a>, <a href="http://hackage.haskell.org/package/mongoDB">MongoDB</a>, <a href="http://hackage.haskell.org/package/tokyocabinet-haskell">Tokyo Cabinet</a>, and pure Haskell libs like <a href="http://hackage.haskell.org/package/TCache">TCache</a>, or safe, high level libs like<a href="http://hackage.haskell.org/package/haskelldb"> HaskellDB</a>.</p>
<p style="text-align:left;">We&#8217;re rapidly running into CPAN-like problems of just managing the weight of so much Haskell code. How do you know which one to use? Should you use, say, Galois&#8217; <a href="http://hackage.haskell.org/package/xml">xml</a> library, or Lemmih&#8217;s <a href="http://hackage.haskell.org/package/libxml">xml</a> library? . <a href="http://www.palgorithm.co.uk/2010/05/why-isnt-haskell-popular-in-industry/">Someone recently</a> said <em>&#8220;It is bewildering trying to figure out which ones are actively supported and which ones are zombie projects that stopped working years ago.&#8221;</em></p>
<p style="text-align:left;">So what are we doing about it?</p>
<p style="text-align:left;">There are four efforts underway to help Haskellers manage this work, and you can contribute!</p>
<ol>
<li><a href="http://hackage.haskell.org/platform/"></a><a href="http://hackage.haskell.org/platform/"><strong>The Haskell Platform</strong></a> &#8211; a easy, one-click installer for the core system, including <strong>a blessed set of libraries, </strong>with a commercially friendly BSD license (like most of Hackage). At the moment, this means <a href="http://hackage.haskell.org/platform/contents.html">just these libraries</a>, and <strong>we need developers to </strong><a href="http://trac.haskell.org/haskell-platform/wiki/AddingPackages"><strong>propose new additions</strong> </a>to the blessed set.</li>
<li>Google Summer of Code: <a href="http://cogracenotes.wordpress.com/hackage-proposal/"><strong>Hackage 2.0</strong></a> &#8211; we have Matt Gruen working this summer to finish the implementation of Hackage 2.0 &#8211; an improved Hackage that will allow for many new features to help sort out the wheat from the chaff in Haskell packages: build reports, wiki commenting, and social voting.</li>
<li>Google Summer of Code: <a href="http://cabaltest.blogspot.com/2010/05/introductions.html"><strong>Cabal Test</strong></a>: we also have Thomas Tuegel working on &#8220;cabal test&#8221;  &#8211; to allow automated testing and reporting of cabalized (and thus, all of Hackage). This is the second plank in the solidifying the quality assurance story for Hackage.</li>
<li>Regular <a href="http://blog.well-typed.com/2009/03/regression-testing-with-hackage/"><strong>regression testing of Hackage</strong></a>: having all that code is great &#8211; it means we can do regular regression testing of compilers and tools on a multi-million line Haskell codebase. For the 6.10 GHC release, for example, we were able to narrow breakages of all known open source Haskell to just 5% of Hackage, and post detailed instructions on how to address those changes. This gives us significant stability.</li>
</ol>
<p>So, the HP to make it simpler to install Haskell and get started with a good set of libraries (several hundred thousand downloads of the installers so far!), a better Hackage to help us rate and rank packages, regression testing against Hackage to keep things stable, and in particular, test reporting support to make it easier to do quality assurance estimates.</p>
<p>How would you like to see changed in the Haskell library world? What libraries do you love? What do you hate? How do you find the packages you need?</p>
<p>And you don&#8217;t have to wait for others to solve this. Write tools to pick the best libs. Do your own quality ratings and share them. Write reviews of packages, and compare them, then let everyone know.</p>
<p>This is open source &#8211; it is up to you to help make things happen.</p>
<br /> Tagged: <a href='https://donsbot.wordpress.com/tag/cabal/'>cabal</a>, <a href='https://donsbot.wordpress.com/tag/community/'>community</a>, <a href='https://donsbot.wordpress.com/tag/ghc/'>ghc</a>, <a href='https://donsbot.wordpress.com/tag/hackage/'>hackage</a>, <a href='https://donsbot.wordpress.com/tag/package/'>package</a>, <a href='https://donsbot.wordpress.com/tag/summer-of-code/'>summer of code</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/donsbot.wordpress.com/545/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/donsbot.wordpress.com/545/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/donsbot.wordpress.com/545/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/donsbot.wordpress.com/545/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/donsbot.wordpress.com/545/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/donsbot.wordpress.com/545/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/donsbot.wordpress.com/545/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/donsbot.wordpress.com/545/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/donsbot.wordpress.com/545/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/donsbot.wordpress.com/545/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/donsbot.wordpress.com/545/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/donsbot.wordpress.com/545/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/donsbot.wordpress.com/545/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/donsbot.wordpress.com/545/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=donsbot.wordpress.com&amp;blog=6244403&amp;post=545&amp;subd=donsbot&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>https://donsbot.wordpress.com/2010/05/31/there-are-a-hell-of-a-lot-of-haskell-libraries-now-what-are-we-going-to-do-about-it/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
	
		<media:content url="https://secure.gravatar.com/avatar/68c3dd15d6cd5d99a63113843d7e1c1b?s=96&#38;d=" medium="image">
			<media:title type="html">dons00</media:title>
		</media:content>

		<media:content url="http://donsbot.files.wordpress.com/2010/05/hackage-june-2010.png" medium="image">
			<media:title type="html">hackage-june-2010</media:title>
		</media:content>
	</item>
	</channel>
</rss>
