[Haskell-cafe] Project postmortem II /Haskell vs. Erlang/

Ketil Malde ketil.malde at bccs.uib.no
Wed Jan 4 03:41:39 EST 2006

Dylan Thurston <dthurston at barnard.edu> writes:

>> http://wagerlabs.com/articles/2006/01/01/haskell-vs-erlang-reloaded

| Compare Erlang
| -record(pot, {
|	  profit = 0,
|	  amounts = []
|	 }).

> [...] complain about "having to explain to the customer how xyFoo is
> really different from zFoo when they really mean the same thing".

Isn't the obvious solution to declare a class here?  I.e. 

   class HasProfits h where profits :: h -> Word64

   data Pot = Pot { pProfits :: !Word64, pAmounts = ![Word64] }

   instance HasProfits Pot where profits = pProfits

And since you like to count LOC, why not use a more compact representation?

   mkPot = Pot 333 []

If it resides close to the data definition, it's easy to keep the two
in sync. 

If I haven't seen further, it is by standing in the footprints of giants

More information about the Haskell-Cafe mailing list