an erlang monad?

Pascal Brisset pascal.brisset@REDACTED
Wed Mar 2 18:19:40 CET 2005

 > That is, fold over a list of functions that update
 > the dictionary. This, I believe, essentially amounts
 > to a monad in other languages. ;-) Even if this is 
 > just me misunderstanding monads (like everyone else),
 > I find the function very useful.

It looks even more like an iterated version the popular "maybe
monad" if each function is allowed to abort the computation:

    with(X, []) ->
    with(X, [F|Fs]) ->
        case F(X) of
            {ok, Y} -> with(Y, Fs);
            {error, E} -> {error, E}

 > What this does is basically free you from the absurd
 > D1, D2, D3, etc. gymnastics, where you will eventually,
 > inevitably mess up the numbering.

Ah, so we are not the only ones... I was ashamed that we had to
write a dedicated linter to catch all these numbering errors :-)

-- Pascal Brisset

More information about the erlang-questions mailing list