Let's say I want to write a server in Haskell. The kind that has high concurrency and simple processing. The kind that would be robust to failures and offer high availability. The kind that Erlang would be good for.
What would be a good set of tools, whether a framework or a set of primitives, to start from?
This is precisely what Haskell is great at. And it has excellent multicore parallelism support, so when you use more threads, you can take advantage of extra cores easily. Remember though, Haskell's aimed at great performance on multicore, Erlang's a bit different, emphasising distributed systems more, and not so much raw performance (e.g. see the benchmarks game, http://benchmarksgame.alioth.debian.org/u64q/compare.php?lang=ghc&lang2=hipe The Haskell's almost always much faster and uses much less memory).
Now, to get started:
You can start with the examples in Real World Haskell, to learn about forkIO and Haskell's lightweight threads, http://book.realworldhaskell.org/read/concurrent-and-multicore-programming.html
GHC's docs on the concurrency tools, http://haskell.org/haskellwiki/GHC/Concurrency
The library to look at for massive, scalable network code is the event library: http://github.com/tibbe/event which makes it easy to use epoll as the method for accepting events from the network. Here's a simple example: http://donsbot.wordpress.com/2010/01/17/playing-with-the-new-haskell-epoll-event-library/
For back to basics, see Simon Marlow's tutorial on building a concurrent web server: http://www.haskell.org/~simonmar/bib/webserverjfp_abstract.html
You should find this task relatively easy, and fun!
Great place to start is the seminal paper by Simon Peyton Jones The Awkward Squad.
... I recently heard a talk you might find relevant. See details at the galois website
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With