[Haskell-beginners] Equivalent of IO Monad in other functional languages?

Karl Voelker karl at karlv.net
Sun Mar 15 21:44:02 UTC 2015


On Sun, Mar 15, 2015, at 09:17 AM, Simon Kitching wrote:
> And AIUI the Haskell compiler/runtime can postpone evaluation of any 
> function (laziness), or reorder function calls whever it thinks this 
> good.

It's not that it "can" but that it must. Haskell's evaluation strategy
is a part of the language specification.

Consider this expression:

let f = 1 : f in take 5 f

You can paste this into ghci and feel confident that it's going to
terminate. You're not at the whim of the runtime.

I think you may find these articles interesting:

https://wiki.haskell.org/Lazy_evaluation
https://wiki.haskell.org/Non-strict_semantics

-Karl


More information about the Beginners mailing list