[Haskell-cafe] Actors and message-passing a la Erlang

Yves Parès limestrael at gmail.com
Tue Jul 27 14:08:07 EDT 2010


>I've found that I like Erlang's pattern matching for sorting through
different kinds of data payloads, but that I prefer to use typed data
channels per Limbo, Go, Plan 9's thread and messaging libraries etc.  I've
often wanted an Erlang with static typing to get this capability.

Actually you are right. And it is not much of a chore to write:
data MyMessages = Something XXX | SomethingElse YYY ZZZ | Stop | ...
given that it ensures your message-passing is correct at compile time.

It gives you an Actor type like:
data Actor msgIn msgOut
Where msgIn is the type of received messages (Erlang's 'receive') and msgOut
the type of sent messages (Erlang's '!').


2010/7/27 David Leimbach <leimy2k at gmail.com>

>
>
> On Tue, Jul 27, 2010 at 5:27 AM, Stefan Schmidt <
> stefanschmidt42 at googlemail.com> wrote:
>
>> Hi Yves,
>>
>>
>>> You say that "With the help of this library it is possible to build
>>> Erlang-Style mailboxes", but how would you solve the issue of static typing?
>>>
>>
>> this wasn't an issue for me because I wanted as much type checking as
>> possible. In many implementations, you have an implicit contract between the
>> sender and the receiver process. In this case, the contract is explicit and
>> the compiler can tell me if I'm trying to send or receive "wrong" data.
>>
>>
>
> I've found that I like Erlang's pattern matching for sorting through
> different kinds of data payloads, but that I prefer to use typed data
> channels per Limbo, Go, Plan 9's thread and messaging libraries etc.  I've
> often wanted an Erlang with static typing to get this capability.
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100727/b0838e2b/attachment.html


More information about the Haskell-Cafe mailing list