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

<channel>
	<title>LAMBDAPHONE &#187; library</title>
	<atom:link href="http://coder.bsimmons.name/blog/tag/library/feed/" rel="self" type="application/rss+xml" />
	<link>http://coder.bsimmons.name/blog</link>
	<description>fragmentary ideas  ䷿  intellectual what-nots  ䷷  and haskell programming  ䷴</description>
	<lastBuildDate>Sun, 29 Jan 2012 17:24:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>simple-actors 0.1.0 released</title>
		<link>http://coder.bsimmons.name/blog/2011/10/simple-actors-0-1-0-released/</link>
		<comments>http://coder.bsimmons.name/blog/2011/10/simple-actors-0-1-0-released/#comments</comments>
		<pubDate>Tue, 11 Oct 2011 18:02:50 +0000</pubDate>
		<dc:creator>jberryman</dc:creator>
				<category><![CDATA[haskell]]></category>
		<category><![CDATA[concurrency]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[release]]></category>

		<guid isPermaLink="false">http://coder.bsimmons.name/blog/?p=583</guid>
		<description><![CDATA[<p>Just a quick announcement of the release of <a href="http://hackage.haskell.org/packages/archive/simple-actors/0.1.0/doc/html/Control-Concurrent-Actors.html">simple-actors</a>, a DSL-style haskell library for more structured concurrent programs via the <a href="http://en.wikipedia.org/wiki/Actor_model">Actor Model</a>. You can fork it on <a href="https://github.com/jberryman/simple-actors">github</a>, and install it via cabal with a </p>
<blockquote><p>cabal</p></blockquote><p>&#8230; <a href="http://coder.bsimmons.name/blog/2011/10/simple-actors-0-1-0-released/" class="read_more">   [ R E A D &#124; M O R E ]</a></p>]]></description>
			<content:encoded><![CDATA[<p>Just a quick announcement of the release of <a href="http://hackage.haskell.org/packages/archive/simple-actors/0.1.0/doc/html/Control-Concurrent-Actors.html">simple-actors</a>, a DSL-style haskell library for more structured concurrent programs via the <a href="http://en.wikipedia.org/wiki/Actor_model">Actor Model</a>. You can fork it on <a href="https://github.com/jberryman/simple-actors">github</a>, and install it via cabal with a </p>
<blockquote><p>cabal install simple-actors
</p></blockquote>
<p>This version is significantly more coherent, powerful and simple than the original 0.0.1 version (which was something I just whipped together for a blog post I haven&#8217;t gotten around to writing yet).</p>
<p>Let me know if you have any comments or suggestions!</p>
]]></content:encoded>
			<wfw:commentRss>http://coder.bsimmons.name/blog/2011/10/simple-actors-0-1-0-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A brief tutorial-introduction to &#8216;fclabels&#8217; 1.0</title>
		<link>http://coder.bsimmons.name/blog/2011/08/a-brief-tutorial-introduction-to-fclabels-1-0/</link>
		<comments>http://coder.bsimmons.name/blog/2011/08/a-brief-tutorial-introduction-to-fclabels-1-0/#comments</comments>
		<pubDate>Sun, 21 Aug 2011 18:39:16 +0000</pubDate>
		<dc:creator>jberryman</dc:creator>
				<category><![CDATA[haskell]]></category>
		<category><![CDATA[fclabels]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[polymorphism]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://coder.bsimmons.name/blog/?p=575</guid>
		<description><![CDATA[<p>Sebastiaan Visser et al. last week announced the release of v1.0 of <a href="http://hackage.haskell.org/package/fclabels">fclabels</a>. This is a short introduction to the changes for people who are already somewhat familiar with the package.</p>
<blockquote><p><strong>Que?</strong> The fclabels package is a haskell library</p></blockquote><p>&#8230; <a href="http://coder.bsimmons.name/blog/2011/08/a-brief-tutorial-introduction-to-fclabels-1-0/" class="read_more">   [ R E A D &#124; M O R E ]</a></p>]]></description>
			<content:encoded><![CDATA[<p>Sebastiaan Visser et al. last week announced the release of v1.0 of <a href="http://hackage.haskell.org/package/fclabels">fclabels</a>. This is a short introduction to the changes for people who are already somewhat familiar with the package.</p>
<blockquote><p><strong>Que?</strong> The fclabels package is a haskell library providing &#8220;first class labels&#8221; for haskell data types and some Template Haskell code for automatically generating said labels. This makes for a more composable and much more powerful alternative to haskell&#8217;s built-in record syntactic sugar. <a href="http://blog.ezyang.com/2010/04/inessential-guide-to-fclabels/">Here</a> is a good introductory tutorial.</p></blockquote>
<p>The new version features (besides some better names) a type for <a href="http://hackage.haskell.org/packages/archive/fclabels/1.0.1/doc/html/Data-Label-Maybe.html">lenses that can fail</a>. S.V. et al. added this functionality in a brilliant and mostly (except for the name changes) backwards compatible way. We&#8217;ll see how it all works now.</p>
<p>We&#8217;ll prepare a module for fclabels in the usual way:</p>
<p><blockquote class="vimblock"><br />
<span class="lnr">1&nbsp;</span><span class="Special">{-# LANGUAGE TemplateHaskell, TypeOperators #-}</span><br />
<span class="lnr">2&nbsp;</span><span class="PreProc">import</span>&nbsp;<span class="Normal">Control.Category</span><br />
<span class="lnr">3&nbsp;</span><span class="PreProc">import</span>&nbsp;<span class="Normal">Data.Label</span><br />
<span class="lnr">4&nbsp;</span><span class="PreProc">import</span>&nbsp;<span class="PreProc">qualified</span>&nbsp;<span class="Normal">Data.Label.Maybe</span>&nbsp;<span class="PreProc">as</span>&nbsp;<span class="Normal">M</span><br />
<span class="lnr">5&nbsp;</span><span class="PreProc">import</span>&nbsp;<span class="Normal">Prelude</span>&nbsp;<span class="PreProc">hiding</span>&nbsp;(<span class="Identifier">(.)</span>,&nbsp;<span class="Identifier">id</span>)<br />
<br /></blockquote></p>
<p>The only odd thing above is our qualified import of <code>Data.Label.Maybe</code> which provides getters, setters etc. that can fail.</p>
<p>We want to generate lenses for the following type, so we do the underdash thing:</p>
<p><blockquote class="vimblock"><br />
<span class="lnr">36&nbsp;</span><span class="Type">data</span>&nbsp;Example&nbsp;<span class="Statement">=</span>&nbsp;X&nbsp;{&nbsp;_int&nbsp;<span class="Statement">::</span>&nbsp;Int&nbsp;,&nbsp;_char&nbsp;<span class="Statement">::</span>&nbsp;Char}<br />
<span class="lnr">37&nbsp;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="Statement">|</span>&nbsp;Y&nbsp;{&nbsp;_int&nbsp;<span class="Statement">::</span>&nbsp;Int&nbsp;,&nbsp;_example&nbsp;<span class="Statement">::</span>&nbsp;Example&nbsp;}<br />
<br /></blockquote></p>
<p>Notice how <code>_int</code> is a valid record for <em>both</em> constructors <code>X</code> and <code>Y</code>, where the other two are partial functions.</p>
<p>Lastly, the usual splice for generating labels:</p>
<p><blockquote class="vimblock"><br />
<span class="lnr">39&nbsp;</span>$(<span class="PreProc">mkLabels[''Example])</span><br />
<br /></blockquote></p>
<p>Let&#8217;s load our file into GHCi and play a little:</p>
<blockquote><pre>
Prelude> :l test.hs
[1 of 1] Compiling Main             ( test.hs, interpreted )
Ok, modules loaded: Main.
*Main> get int $ X 1 'a'
1
*Main> M.get int $ X 1 'a'
Just 1
*Main> M.get char $ X 1 'a'
Just 'a'
*Main> M.get example $ X 1 'a'
Nothing
*Main> get example $ X 1 'a'

<interactive>:1:5:
    No instance for (Control.Arrow.ArrowZero (->))
      arising from a use of `example'
    Possible fix:
      add an instance declaration for (Control.Arrow.ArrowZero (->))
    In the first argument of `get', namely `example'
    In the expression: get example
    In the expression: get example $ X 1 'a'
</interactive></pre>
</blockquote>
<p>Above we saw that:</p>
<ul>
<li>the total <code>int</code> label could be used in both <code>get</code> and <code>Data.Label.Maybe.get</code>
</li>
<li>M.get on our &#8220;partial lenses&#8221; (<code>example</code> and <code>char</code>) safely returned a Maybe value.
</li>
<li>pure <code>get</code> used with partial lenses doesn&#8217;t type check
</li>
</ul>
<p>We need to look at some types (note I&#8217;ve cleaned up some of these type signatures, yours may look uglier):</p>
<blockquote><pre>
*Main> :t get
get :: (f :-> a) -> f -> a
*Main> :t M.get
M.get :: (f M.:~> a) -> f -> Maybe a
*Main> :info (:->)
type (:->) f a = Data.Label.Pure.PureLens f a
  	-- Defined in Data.Label.Pure
*Main> :info (M.:~>)
type (M.:~>) f a = Data.Label.Maybe.MaybeLens f a
  	-- Defined in Data.Label.Maybe
</pre>
</blockquote>
<p>You can see above that setters and getters are monomorphic. But how then were we able to use <code>int</code> in both <code>get</code> and <code>M.get</code>? Time to look at the types of our TH-generated lenses:</p>
<blockquote><pre>
*Main> :t int
int
  :: Control.Arrow.Arrow (~>) => Lens (~>) Example Int
*Main> :t char
char
  :: (Control.Arrow.ArrowZero (~>),
      Control.Arrow.ArrowChoice (~>)) =>
     Lens (~>) Example Char
*Main> :t example
example
  :: (Control.Arrow.ArrowZero (~>),
      Control.Arrow.ArrowChoice (~>)) =>
     Lens (~>) Example Example
</pre>
</blockquote>
<p>Whoah! Lenses themselves are polymorphic in the Arrow class; partial lenses have additional restrictions of <code>ArrowZero</code> and <code>ArrowChoice</code> allowing for failure and <a href="http://hackage.haskell.org/packages/archive/base/latest/doc/html/Control-Arrow.html#t:ArrowChoice">choice</a>. </p>
<p>This is wizardry of the highest order.</p>
<p>Notice how we can still compose lenses freely, whether partial or total:</p>
<blockquote><p>*Main> :t (.)<br />
(.) :: Category cat => cat b c -> cat a b -> cat a c<br />
*Main> M.get (int . example) (Y 1 (X 2 &#8216;a&#8217;))<br />
Just 2</p></blockquote>
<h2>A note on <code>mkLabelsNoTypes</code></h2>
<p>I had been using the noTypes variation to generate lenses that I was exporting in a module, because the TH-assigned type sigs looked pretty nasty. If you do this with >1.0 you will run into the monomorphism restriction and ambiguous type variables. </p>
<p>Instead I would suggest defining <em>exported</em> lables by hand and giving them a nicer looking (or monomorphic if you prefer) type sig.</p>
<p>You can even let fclabels generate the code and just paste it in, e.g.:</p>
<blockquote><pre>
Prelude> :set -ddump-splices
Prelude> :l test.hs
[1 of 1] Compiling Main             ( test.hs, interpreted )
test.hs:1:1: Splicing declarations
    mkLabels ['Example]
  ======>
    test.hs:40:3-21
    char ::
      forall ~>[a1kk]. (Control.Arrow.ArrowChoice ~>[a1kk],
                        Control.Arrow.ArrowZero ~>[a1kk]) =>
      Lens ~>[a1kk] Example Char
    {-# INLINE[0] CONLIKE char #-}
    char
      = let
          c[a1kl]
            = (Control.Arrow.zeroArrow Control.Arrow.||| Control.Arrow.returnA)
        in
          Data.Label.Abstract.lens
            (c[a1kl]
           . Control.Arrow.arr
               (\ p[a1km]
                  -> case p[a1km] of {
                       X {} -> Right (_char p[a1km])
                       _ -> Left GHC.Unit.() }))
            (c[a1kl]
           . Control.Arrow.arr
               (\ (v[a1kn], p[a1ko])
                  -> case p[a1ko] of {
                       X {} -> Right (p[a1ko] {_char = v[a1kn]})
                       _ -> Left GHC.Unit.() }))
...
</pre>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://coder.bsimmons.name/blog/2011/08/a-brief-tutorial-introduction-to-fclabels-1-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Module &#8216;chan-split&#8217; released</title>
		<link>http://coder.bsimmons.name/blog/2011/07/module-chan-split-released/</link>
		<comments>http://coder.bsimmons.name/blog/2011/07/module-chan-split-released/#comments</comments>
		<pubDate>Mon, 18 Jul 2011 02:17:09 +0000</pubDate>
		<dc:creator>jberryman</dc:creator>
				<category><![CDATA[haskell]]></category>
		<category><![CDATA[concurrency]]></category>
		<category><![CDATA[IO]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[release]]></category>

		<guid isPermaLink="false">http://coder.bsimmons.name/blog/?p=571</guid>
		<description><![CDATA[<h2>Whaa?</h2>
<p>chan-split is a haskell library that is a wrapper around <a href="http://hackage.haskell.org/packages/archive/base/latest/doc/html/Control-Concurrent-Chan.html"><code>Control.Concurrent.Chan</code></a>s that separates a Chan into a readable side and a writable side. </p>
<p>We also provide two other modules: <code>Data.Cofunctor</code> (because there didn&#8217;t seem to be one&#8230; <a href="http://coder.bsimmons.name/blog/2011/07/module-chan-split-released/" class="read_more">   [ R E A D &#124; M O R E ]</a></p>]]></description>
			<content:encoded><![CDATA[<h2>Whaa?</h2>
<p>chan-split is a haskell library that is a wrapper around <a href="http://hackage.haskell.org/packages/archive/base/latest/doc/html/Control-Concurrent-Chan.html"><code>Control.Concurrent.Chan</code></a>s that separates a Chan into a readable side and a writable side. </p>
<p>We also provide two other modules: <code>Data.Cofunctor</code> (because there didn&#8217;t seem to be one anywhere), and <code>Control.Concurrent.Chan.Class</code>. The latter creates two classes: <code>ReadableChan</code> and <code>WritableChan</code>, making the fundamental chan functions polymorphic, and defining an instance for standard <code>Chan</code> as well as <code>MVar</code> (an MVar is a singleton bounded channel, wanna fight about it?).</p>
<h2>Why?</h2>
<p>Having separate read/write sides makes it easier to reason about your code, supports doing some cool things (defining <code>Functor</code> and <code>Cofunctor</code> instances), and makes more sense (e.g. the function of <a href="http://hackage.haskell.org/packages/archive/base/latest/doc/html/Control-Concurrent-Chan.html#t:dupChan">dupChan</a> in the base library is much easier to understand as an operation that happens on an <code>OutChan</code>).</p>
<p>Also I use it in (the coming new, less stupid version of) my module <a href="http://hackage.haskell.org/package/simple-actors">simple-actors</a>.</p>
<h2>Where?</h2>
<p>You can get it with a:</p>
<blockquote><p>cabal install chan-split</p></blockquote>
<p>And check out the <a href="http://hackage.haskell.org/package/chan-split">docs on hackage</a>. Or check out the <a href="https://github.com/jberryman/chan-split">source on github</a> and send me pull requests.</p>
<h1>Usage</h1>
<p>Let&#8217;s write the numbers 1 &#8211; 10 to the InChan and read them as a stream in the OutChan:</p>
<p><blockquote class="vimblock"><br />
<span class="lnr">&nbsp;1&nbsp;</span><span class="Structure">module</span>&nbsp;<span class="Normal">Main</span><br />
<span class="lnr">&nbsp;2&nbsp;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span class="Structure">where</span><br />
<span class="lnr">&nbsp;3&nbsp;</span><br />
<span class="lnr">&nbsp;4&nbsp;</span><span class="PreProc">import</span>&nbsp;<span class="Normal">Control.Concurrent.Chan.Split</span><br />
<span class="lnr">&nbsp;5&nbsp;</span><span class="PreProc">import</span>&nbsp;<span class="Normal">Control.Concurrent</span>(<span class="Function">forkIO</span>)<br />
<span class="lnr">&nbsp;6&nbsp;</span><br />
<span class="lnr">&nbsp;7&nbsp;</span><span class="Function">main</span>&nbsp;<span class="Operator">=</span>&nbsp;<span class="Statement">do</span><br />
<span class="lnr">&nbsp;8&nbsp;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span class="Comment">-- Instead of a single Chan, we initialize a pair of (InChan,OutChan)</span><br />
<span class="lnr">&nbsp;9&nbsp;</span>&nbsp;&nbsp;&nbsp;&nbsp;(inC,outC)&nbsp;<span class="Operator">&lt;-</span>&nbsp;newSplitChan<br />
<span class="lnr">10&nbsp;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span class="Comment">-- fork a writer on the InChan</span><br />
<span class="lnr">11&nbsp;</span>&nbsp;&nbsp;&nbsp;&nbsp;forkIO&nbsp;<span class="Operator">$</span>&nbsp;writeStuffTo&nbsp;inC&nbsp;[<span class="Number">1</span><span class="Operator">..</span><span class="Number">10</span>]<br />
<span class="lnr">12&nbsp;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span class="Comment">-- read from the OutChan in the main thread:</span><br />
<span class="lnr">13&nbsp;</span>&nbsp;&nbsp;&nbsp;&nbsp;getStuffOutOf&nbsp;outC&nbsp;<span class="Operator">&gt;&gt;=</span><br />
<span class="lnr">14&nbsp;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mapM_&nbsp;print&nbsp;<span class="Operator">.</span>&nbsp;take&nbsp;<span class="Number">10</span>&nbsp;<br />
<br /></blockquote></p>
<p>And we&#8217;ll make <code>writeStuffTo</code> and <code>getStuffOutOf</code>, simply be the standard functions. Note that <code>writeListToChan</code> is actually polymorphic.</p>
<p><blockquote class="vimblock"><br />
<span class="lnr">16&nbsp;</span><span class="Function">writeStuffTo</span>&nbsp;::&nbsp;InChan&nbsp;Int&nbsp;<span class="Operator">-&gt;</span>&nbsp;[Int]&nbsp;<span class="Operator">-&gt;</span>&nbsp;IO&nbsp;()<br />
<span class="lnr">17&nbsp;</span><span class="Function">writeStuffTo</span>&nbsp;<span class="Operator">=</span>&nbsp;writeList2Chan<br />
<span class="lnr">18&nbsp;</span><br />
<span class="lnr">19&nbsp;</span><span class="Function">getStuffOutOf</span>&nbsp;::&nbsp;OutChan&nbsp;Int&nbsp;<span class="Operator">-&gt;</span>&nbsp;IO&nbsp;[Int]<br />
<span class="lnr">20&nbsp;</span><span class="Function">getStuffOutOf</span>&nbsp;<span class="Operator">=</span>&nbsp;getChanContents<br />
<br /></blockquote></p>
<p>Now I&#8217;ll demonstrate the use of our Functor and Cofunctor instances by re-defining those two functions above, after importing our Cofunctor class</p>
<p><blockquote class="vimblock"><br />
<span class="lnr">17&nbsp;</span><span class="PreProc">import</span>&nbsp;<span class="Normal">Data.Cofunctor</span><br />
<span class="lnr">18&nbsp;</span><br />
<span class="lnr">19&nbsp;</span><span class="Operator">...</span><br />
<span class="lnr">20&nbsp;</span><br />
<span class="lnr">21&nbsp;</span><span class="Comment">-- we could convert the [Int] to [String] here but will instead demonstrate the</span><br />
<span class="lnr">22&nbsp;</span><span class="Comment">-- Cofmap instance:</span><br />
<span class="lnr">23&nbsp;</span><span class="Function">writeStuffTo</span>&nbsp;::&nbsp;InChan&nbsp;String&nbsp;<span class="Operator">-&gt;</span>&nbsp;[Int]&nbsp;<span class="Operator">-&gt;</span>&nbsp;IO&nbsp;()<br />
<span class="lnr">24&nbsp;</span><span class="Function">writeStuffTo</span>&nbsp;<span class="Operator">=</span>&nbsp;writeList2Chan&nbsp;<span class="Operator">.</span>&nbsp;cofmap&nbsp;show<br />
<span class="lnr">25&nbsp;</span><br />
<span class="lnr">26&nbsp;</span><span class="Comment">-- likewise this demonstrates the Functor instance of OutChan:</span><br />
<span class="lnr">27&nbsp;</span><span class="Function">getStuffOutOf</span>&nbsp;::&nbsp;OutChan&nbsp;String&nbsp;<span class="Operator">-&gt;</span>&nbsp;IO&nbsp;[Int]<br />
<span class="lnr">28&nbsp;</span><span class="Function">getStuffOutOf</span>&nbsp;<span class="Operator">=</span>&nbsp;getChanContents&nbsp;<span class="Operator">.</span>&nbsp;fmap&nbsp;read<br />
<br /></blockquote></p>
<p>All right, leave your love or hate and stay tuned for the new (less stupider) simple-actors lib.</p>
]]></content:encoded>
			<wfw:commentRss>http://coder.bsimmons.name/blog/2011/07/module-chan-split-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>simple-actors: a simple Actor Model concurrency library</title>
		<link>http://coder.bsimmons.name/blog/2011/05/simple-actors-a-simple-actor-model-concurrency-library/</link>
		<comments>http://coder.bsimmons.name/blog/2011/05/simple-actors-a-simple-actor-model-concurrency-library/#comments</comments>
		<pubDate>Mon, 30 May 2011 19:31:13 +0000</pubDate>
		<dc:creator>jberryman</dc:creator>
				<category><![CDATA[haskell]]></category>
		<category><![CDATA[concurrency]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[monads]]></category>
		<category><![CDATA[release]]></category>

		<guid isPermaLink="false">http://coder.bsimmons.name/blog/?p=568</guid>
		<description><![CDATA[<blockquote><p><strong>EDIT:</strong> I&#8217;ve just released <a href="http://hackage.haskell.org/packages/archive/simple-actors/0.1.0/doc/html/Control-Concurrent-Actors.html">version 0.1.0</a> of this library. It is a complete re-write / re-think that I think makes the library much more attractive, simple and powerful. There won&#8217;t be any more dramatic API changes.</p></blockquote>
<p>I was in&#8230; <a href="http://coder.bsimmons.name/blog/2011/05/simple-actors-a-simple-actor-model-concurrency-library/" class="read_more">   [ R E A D &#124; M O R E ]</a></p>]]></description>
			<content:encoded><![CDATA[<blockquote><p><strong>EDIT:</strong> I&#8217;ve just released <a href="http://hackage.haskell.org/packages/archive/simple-actors/0.1.0/doc/html/Control-Concurrent-Actors.html">version 0.1.0</a> of this library. It is a complete re-write / re-think that I think makes the library much more attractive, simple and powerful. There won&#8217;t be any more dramatic API changes.</p></blockquote>
<p>I was in need of a simple, tight library implementing the <a href="http://en.wikipedia.org/wiki/Actor_model">Actor Model of concurrency</a> and didn&#8217;t find one on hackage, so I wrote my own. You can check out the docs <a href="http://hackage.haskell.org/package/simple-actors-0.0.1">here</a> and get it with a </p>
<blockquote><p>$ cabal install simple-actors</p></blockquote>
<p>The library is really just a thin layer around <code>Chan</code>s, and I made no great effort to ensure that the library conforms to any particular formal definition of the actor model, but rather tried to make an idiomatic haskell library for more structured concurrent programming.</p>
<p>I&#8217;ve been going all sorts of ways with this and would appreciate any feedback anyone would like to share.</p>
<p>I&#8217;ll be using it in some (hopefully fun and interesting) posts in the near future, to model concurrent systems, and also exploring creating a more involved concurrency library. So stay tuned if that&#8217;s what you&#8217;re into.</p>
]]></content:encoded>
			<wfw:commentRss>http://coder.bsimmons.name/blog/2011/05/simple-actors-a-simple-actor-model-concurrency-library/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>PEZ: the Potentially-Excellent Zipper library release</title>
		<link>http://coder.bsimmons.name/blog/2011/04/pez-zipper-library-released/</link>
		<comments>http://coder.bsimmons.name/blog/2011/04/pez-zipper-library-released/#comments</comments>
		<pubDate>Tue, 19 Apr 2011 20:07:35 +0000</pubDate>
		<dc:creator>jberryman</dc:creator>
				<category><![CDATA[haskell]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[release]]></category>
		<category><![CDATA[TypeSystem]]></category>
		<category><![CDATA[zipper]]></category>

		<guid isPermaLink="false">http://coder.bsimmons.name/blog/?p=554</guid>
		<description><![CDATA[<p>I&#8217;m happy to announce the release of a <a href="http://hackage.haskell.org/package/pez">zipper library I named <strong>PEZ</strong></a>! I&#8217;ve been learning and building this silly library almost as long as I&#8217;ve been learning haskell. It&#8217;s not as great as it could be, but I&#8217;m&#8230; <a href="http://coder.bsimmons.name/blog/2011/04/pez-zipper-library-released/" class="read_more">   [ R E A D &#124; M O R E ]</a></p>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m happy to announce the release of a <a href="http://hackage.haskell.org/package/pez">zipper library I named <strong>PEZ</strong></a>! I&#8217;ve been learning and building this silly library almost as long as I&#8217;ve been learning haskell. It&#8217;s not as great as it could be, but I&#8217;m releasing it now because it&#8217;s about time.</p>
<p>You can check it out with a:</p>
<blockquote><p><code>cabal install pez</code></p></blockquote>
<p>The library provides a generic <a href="http://www.haskell.org/haskellwiki/Zipper">zipper</a> that can be used on all types in the Typeable class, for which the user defines (or generates) lenses from the excellent <a href="http://hackage.haskell.org/package/fclabels">fclabels</a> package.</p>
<p>Since <code>Typeable</code> instances are deriveable in GHC and fclabels lenses can be generated with a line of TH code, this makes for a very pain-free and intuitive zipper. </p>
<p>The <a href="http://hackage.haskell.org/packages/archive/base/latest/doc/html/Data-Typeable.html">Typeable class</a> gives us the ability to move up and down through complex mutually-recursive structures, even &#8220;down through&#8221; reversible computations!</p>
<p>The lenses from &#8216;fclabels&#8217; give us a way of referring to elements in data types in a way that is composable, allowing us to store our history as continuations and provide powerful mechanisms for &#8220;saving&#8221; a path through a data structure.</p>
<p>There is more to do: in particular I haven&#8217;t yet examined any of the performance characteristics of the approach I take, but please try it out and let me know how it works for you!</p>
]]></content:encoded>
			<wfw:commentRss>http://coder.bsimmons.name/blog/2011/04/pez-zipper-library-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk
Database Caching 1/15 queries in 0.099 seconds using disk

Served from: coder.bsimmons.name @ 2012-02-05 11:19:01 -->
