Discussion:
java/c/etc. are all "in a monad"
(too old to reply)
raould
2010-02-10 23:09:22 UTC
Permalink
i assume that means passing the whole heap around? but the heap
wouldn't be copied-with-changes, it would be directly mutated. does
the State monad in haskell have some hack in the implementation to let
it really mutate, like how the IO monad has a hack to make things
actually interactive at runtime?
Ertugrul Söylemez
2010-02-11 09:55:13 UTC
Permalink
Post by raould
i assume that means passing the whole heap around? but the heap
wouldn't be copied-with-changes, it would be directly mutated. does
the State monad in haskell have some hack in the implementation to let
it really mutate, like how the IO monad has a hack to make things
actually interactive at runtime?
No, the IO monad models a state monad containing the state of the whole
universe. No state is ever mutated in the IO monad (or any other state
monad). But IO is just a model to make real world interaction
consistent with Haskell's language semantics. In practice, values are
mutated, where appropriate.

If you want mutation specifically, you want STRefs or IORefs, but in
general you don't need that.


Greets
Ertugrul
--
nightmare = unsafePerformIO (getWrongWife >>= sex)
http://blog.ertes.de/
Continue reading on narkive:
Loading...