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

Heinrich Apfelmus apfelmus at quantentunnel.de
Mon Mar 16 14:11:15 UTC 2015


Karl Voelker wrote:
> 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

Strictly speaking, the Haskell language standard only specifies that 
Haskell has non-strict semantics, not that it needs to be evaluated 
using lazy evaluation.

Of course, the two are related. I have tried to expand on the details here:

   https://hackhands.com/non-strict-semantics-haskell


Best regards,
Heinrich Apfelmus

--
http://apfelmus.nfshost.com



More information about the Beginners mailing list