Hacker News new | ask | show | jobs
by AnimalMuppet 2958 days ago
OK, for the slow of understanding:

What I think you said is that, in an untyped language, a function will just return "something" (as far as the compiler is concerned). But in a typed language, the compiler knows that a monad was returned. So the point of the monad is to make the compiler do magic, not to make the runtime do magic.

Is that accurate?

1 comments

Well.. It's like 25% accurate, and you hit the part you were most worried about. But you have been seriously misled about monads in the past.

There is no magic in monads. At the level of runtime operations, they're just a couple of functions.

The magic taking place in the compiler is type inference guiding the selection of the right pair of functions during compilation. Without that, you have to explicitly use the correct functions. It's much easier to offload that bookkeeping to a computer than it is to do it yourself.