an erlang monad?

Ulf Wiger ulf@REDACTED
Thu Mar 3 06:43:32 CET 2005


Den 2005-03-02 22:54:54 skrev Luke Gorrie <luke@REDACTED>:


> But surely the state monad is just a poor man's process dictionary..
>
>     D = make_ref(),
>     put(D, mk_dict(default_options() ++ Options)),
>     read_options_file(D),
>     store_options(Options, D),
>     post_process_options(D),
>     ...
>     erase(D).

Well, if you want to be all imperative about it, yes. (:
But one of the things I want to do this time is to
be able to undo easily if something goes wrong.

With a functional data structure, this is trivial.

/Uffe



More information about the erlang-questions mailing list