As we all know and love, Haskell helps us to write correct code, especially in pure settings. Once the real world enters the picture, things get slightly murkier though. GHC Haskell allows for efficient IO, threading, and brings advanced ways to handle exceptions. When writing an application handling independent requests separately, things aren’t too bad. However, when there’s interaction between requests, shared state within the application, coordination of access to external services, etc., things become quite a bit more complex.
To handle this exceptional world, some languages/platforms/frameworks adopted a “let it crash” model, which IMHO is the easiest way to handle this real-world environment: instead of trying to intelligently handle everything that can go wrong, simply quit when some exceptional situation is detected and let some other entity pick up the pieces. The best-known example bringing this theory into practice is likely Erlang.
Over the years, several projects attempted to bring Erlang-style processes (sometimes called ‘actors’) to Haskell. Many are merely proof-of-concepts, or fail to capture the essence of Erlang’s model, e.g., not providing equivalents of
monitor, or only supporting a FIFO mailbox without the ability to match on messages. The most “complete” implementation is likely found in
distributed-process, an implementation of the paper “Towards Haskell in the Cloud” and successor of the
distributed-process aims to bring cross-node remote capabilities (as does Erlang), including sending closures to remote nodes, and much more. However, despite some impressive engineering, IMHO it didn’t succeed in capturing the community’s interest sufficiently, and now seems somewhat undermaintained. Furthermore, it can be a tad complex to use in an application that’s not (internally) distributed across nodes.
So, I was wondering: would there be any community interest in a project that provides an implementation of the actor model, following the semantics and functionality Erlang (and, let’s not forget, OTP) brings, but restricted to single-process operations, i.e., no cross-process/cross-node features. Of course, the latter can be built on top of the process-local core functionality, as e.g., the
Partisan library does, bypassing Erlang’s distributed capabilities.
If this is the case, would anyone be willing to actively contribute to such project? I’d love to work on this with a group of motivated developers, both newcomers to Haskell as well as veterans, instead of building it all by myself . On the Haskell side, there’s a ton to learn from
distributed-process (its implementation of pattern matching on mailbox messages, for example, is very intriguing), and of course Erlang, its semantics, and the behaviours provided by OTP should be studied as well.
I started assembling some thoughts in a wiki page, though right now everything is open for debate, of course.
Would love to hear from you if you’d be enthousiastic about this project, and willing to collaborate!