[erlang-questions] Erlang vs. Haskell

mad.one <>
Tue Jul 3 13:47:09 CEST 2007


Given what you've found yourself already doing, I would say you stick with Erlang for now. You get mass scale 
concurrency cheap and the message-oriented syntax is, personally, a pleasure to work with. :) Once you start 
stepping out into a much bigger, concurrent world, erlang is a better choice for what you're doing, hands down 
if you ask me.

Now, granted, with Haskell you get some nice things too. You get monadic abstractions which, while tough to 
grok at first, provide a very nice mechanism to remove code boilerplate, as well as let you create the rules 
as to how a 'sequential' action/function should occur (quotes on 'sequential' as in haskell, order doesn't 
matter: monads give you the sense of sequential evaluation, but you can describe exactly what happens under 
the hood, since the monadic do-notation in haskell is just syntactic sugar. This allows you to do things like 
pass around state transparently.)

Monads are a lot of things, however, which can be confusing at first. No monad really follows a 'guiding 
principle' as to how it should act (although there are laws all monads must abide by.) Some monads, for 
example, State and Reader, act as a container which allows you to have an outermost 'environment' where 
globalized data is held, so that anything executed in this container has access to it, in a language where 
there things are referentially transparent (that is, it's just acting like a global variable in C or 
somesuch.) The IO monad gives the notion of a side effect, etc. etc..


There are also other benefits. The haskell type system is incredbly strong and flexible in itself. The 
compiler -will- complain. A lot. But this is something that shouldn't aggrivate you: without the compiler 
catching all those type-errors (remember, very strong,) those issues would most likely manifest into runtime 
bugs rather than compile-time bugs. So the type system basically offers you debugging for free. This is why 
after you generally get a haskell program to compile fully, it just seems to 'work.' The type system will 
ensure this correctness.



Haskell is a language where things can be 'hard' but they just hit the point of 'hard enough.' I learned a lot 
while doing Haskell, so while you might not use it for this project (again, I waver in Erlang's favor here), I 
highly advise it's investigation  anyway. I don't think you'll regret it; once you can get past the initial 
frusterations (I felt as though I couldn't write 6 lines of code without a thousand type errors!), and you'll 
see a very amazing, beautiful language underneath.


Austin Seipp



More information about the erlang-questions mailing list