Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Monads

Name: Anonymous 2009-03-16 7:10

How are monads different than side effects?

Name: Anonymous 2009-03-16 15:14

Monads are just a way to organize computation and avoid
non-deterministic results for non-commutative operations like IO.

For example, when you say f(x) + g(y), their order of
execution is not and should not be defined. But what if they have side
effects, e. g. puts("lol") + puts("wut")? We can say that
every function with side-effects takes world as an implicit argument and
returns it, thus we can have puts("wut", puts("lol", world)).
The external puts() depends on its second argument, so the internal puts()
get executed first and there's no way around that. It can be generalized
for arbitrary computations, not only IO.

Please correct me if I'm wrong.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List