Re:Are Monads a Waste of Time?
by steveklabnik on Tuesday February 20, 2018 @09:20AM
(#16420438)
unsafe is not viral; if it was, everything would be unsafe. An unsafe block is the boundary where you tell the compiler "I've got this bit", and so it trusts you and considers it safe.
Re:Are Monads a Waste of Time?
by whateveracct on Tuesday February 20, 2018 @08:56PM
(#16426196)
Funnily enough, “unsafe” in Haskell (e.g. unsafePerformIO) is the same way. Not viral so as to say “trust me.”
- IO can be seen as a tag added to a type that brings »the outside« into scope: the console, the network, current time, the harddrive. In Rust, these are always available, regardless of the type of the expression at hand.
- IO is »viral«, in the way that things that touch IO will become IO as well; there is no way to remove IO to yield a pure value. If a function in Rust contains an unsafe block, is the whole thing unsafe? I don’t know enough Rust, but I think it’s not.