News for hackers. Stuff that matters.
Re:Standard ML in 2020 by jberryman on Sunday October 25, 2020 @10:52PM (#24892425)
> doesn't pretend the world is a pure function.

At a first approximation, Haskell pretends the world is a piece of state, not a pure function.

Re:Standard ML in 2020 by marcosdumay on Monday October 26, 2020 @11:02AM (#24896888)
To be a bit pedantic (because this thing is interesting), it's more like a context. In Haskell you'll say "this code must run on the real world".

Mercury literally pretends the world is a piece of state. You explicitly say "Here, run this code. The world before it runs is on variable `a`, place the world after it runs on variable `b`".

Re:Standard ML in 2020 by fanf2 on Monday October 26, 2020 @01:18PM (#24898560)
The classic paper Imperative Functional Programming https://www.microsoft.com/en-us/research/publication/imperat... introduced the IO monad and explained that its internals are based on passing around the state of the world. The monad hides the world and keeps it linear. The compiler (ghc) optimizes out the world so that it is implicit in the compiled program. I believe this is still the way that ghc works.
Re:Standard ML in 2020 by marcosdumay on Tuesday October 27, 2020 @12:03AM (#24904386)
Oh, yes, the stdlib does pretend the world is a piece of data. But it does a very good job on keeping this hidden from any developer, so this is more of a compiler design that does not leak into the language.