4 ms·
There is no way to avoid leaking implementation details, it's just a matter of how much you leak. Even monads leak their performance characteristics.
by rictic 7y ago
There is no way to avoid leaking implementation details, it's just a matter of how much you leak. Even monads leak their performance characteristics.
- whateveracct 7y ago*sometimes and not always State, for example, doesn't leak. You never worry about the fact that it's a function `s -> (s, a)` and it gets optimized away like nuts.
- rictic 7y agoThis is an example in favor of the fact that abstractions can't paper over performance characteristics. Users may depend on them. In the unlikely event that there was a change to the implementation of the State monad, or to one's compiler, such that the State monad was not optimized away, it would be disruptive to users. It would probably be treated as a bug, even if the only change in behavior was in additional CPU and memory usage. This is a corollary of Hyrum's Law.