simple-actors: a simple Actor Model concurrency library

30/05/2011

EDIT: I’ve just released version 0.1.0 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’t be any more dramatic API changes.

I was in need of a simple, tight library implementing the Actor Model of concurrency and didn’t find one on hackage, so I wrote my own. You can check out the docs here and get it with a

$ cabal install simple-actors

The library is really just a thin layer around Chans, 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.

I’ve been going all sorts of ways with this and would appreciate any feedback anyone would like to share.

I’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’s what you’re into.

5 Comments

When is it okay to “fail”?

16/02/2011

That’s the question.

In designing a couple libraries the question of the proper use of the Monad class’s fail method has come up more than once.

On the one hand, many people consider fail to be a wart on the face of an otherwise pure implementation of an elegant construction borrowed from category theory. It’s as if someone defined scissors as

“two metal blades with handles, attached by a pivot… plus a bandaid in case you cut yourself”.

But on the other hand many instances of Monad have a logical and intuitive way of encapsulating failure, whether it be Nothing in Maybe, or the empty list in []. And for monad’s that have no reasonable way of encapsulating failure, a default method (raising an exception) can be used.

Read the rest of this article »

No Comments

DeBruijn Sequences pt.3 – The “Prefer Opposite” algorithm

2/12/2009

This is the third post of mine on DeBruijn sequences, and is in preparation for another post to come which I hope should be an interesting investigation into a possible parallel algorithm. The first two posts are here and here.
Read the rest of this article »

No Comments