Hacker News new | ask | show | jobs
by agumonkey 3336 days ago
Wild guess, this is monadic style friendly right ? threading implicit variables (rng, etc) is often used in tutorials.
1 comments

Yep -- actually, if you look at how the IO type is defined in Haskell, it looks basically like this (there is an object that represents the "state of the world" that gets threaded through computations).
Alright. One distinction though is that vanilla IO monad has no logical constraint on consumption. You could technically thread a resource through a function many times and Haskell wouldn't complain. (This is blurry but I had something clear in mind, someone at a Haskeel meetup showed how to enforce constraints on monads through some kind of Phantom Type trick)