4 ms·
Right, but you are addressing only part of the story to side-effects. IO is another story, which rust doesn't address.
by xfer 9y ago
Right, but you are addressing only part of the story to side-effects. IO is another story, which rust doesn't address.
- mpartel 9y agoThe standard library doesn't, and most crates don't, but I'm pretty sure nothing prevents you from writing libraries in a style where all IO requires mutable access to some explicit unique "World" object, similar to Clean. Passing a unique world object around is effectively the same as composing with the IO monad, and borrowing 'f(&mut world)' is basically equivalent to 'let world = f(world)'. Maybe someone will one day write a standard library in that style.
- xfer 9y agoIt is not going to be convenient because rust doesn't have higher kinds. I see people making this argument in other language contexts e.g. Ocaml; but they have no typeclasses, which make writing monadic style code extremely inconvenient.