[Haskell-cafe] Pike's Newsqueak talk

Derek Elkins derek.a.elkins at gmail.com
Fri Jun 5 23:32:55 EDT 2009


On Fri, Jun 5, 2009 at 8:14 PM, Tim Newsham <newsham at lava.net> wrote:
> I just watched http://video.google.com/videoplay?docid=810232012617965344
>
> It's a great talk that is suprisingly relevant to Haskell programming
> (although at first blush it looks a bit unrelated). (It refs a lot of older
> work that actually led me to Haskell in the first place by way of McIlroy's
> haskell power-series paper).  Anyway, I thought it would be of general
> interest.
>
> A lot of the progrms he discusses are a lot more elegant in pure Haskell
> code (ie. prime number sieve, power series), but his language also supports
> an interesting imperative primitive that lets you pick the first available
> value from a set of channels which isn't available in pure Haskell
> expressions.  Has anyone implemented a primitive like this for Haskell?

Traditionally and as demonstrated in McIlroy's power series paper,
channels are modelled as streams.  I'm pretty sure the primitive you
are looking for is (equivalent to) the non-deterministic merge, which
is, again, the traditional way of adding such features (see, e.g.
SICP).  It is of course an impure operation and thus not implementable
in pure Haskell and not a pure expression in Haskell.  It is
implemented in Control.Concurrent as mergeIO and nmergeIO.
http://www.haskell.org/ghc/docs/latest/html/libraries/base/Control-Concurrent.html#7

And yes, Rob Pike's work is great.  I particularly like the concurrent
windowing system stuff and would like to implement something like it
in (Concurrent) Haskell.


More information about the Haskell-Cafe mailing list