[Haskell-cafe] Haskell vs GC'd imperative languages, threading, parallelizeability (is that a word? :-D )

Bulat Ziganshin bulat.ziganshin at gmail.com
Fri Aug 10 07:27:58 EDT 2007


Hello Michael,

Friday, August 10, 2007, 12:50:43 PM, you wrote:

> As for threading, in addition to Haskell's approach you might also
> look at Erlang, which has a quite 
> different (and quite interesting) approach to the whole problem.  I wonder if anyone has tried to
> implement a message-passing style of concurrency in Haskell.

if you mean Erlang's sophisticated rules of which messages in queue to
process first - this may be not yet implemented for Haskell. if you
mean that program is just many threads which pass messages through
channels to each other - it's easily accomplished in Haskell through
Chan constructor. you can look at chameneos shootout entry, for
example

in my program (http://www.haskell.org/bz/FreeArc-sources.tar.gz) i run
~10 threads that process data sequentially - i.e. results of first
thread are consumed by second one and so on. i glue them together with
my own tiny threads library which somewhat mimics unix pipes:

runP$ thread1 |> thread2 |> thread3 ...

you can find this lib in Process.hs module. overall, i think that key
to Haskell's simplicity of developing multithreaded programs is its
immutable data, plus type inference which significantly improves
gluing things together and using higher-order funcs


-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Haskell-Cafe mailing list