4 ms·
Yes and some would argue that all Haskell functions are pure even those that return computations in the IO monad. One can use referential transparency to reason
by grumpyprole 5y ago
Yes and some would argue that all Haskell functions are pure even those that return computations in the IO monad. One can use referential transparency to reason about the IO monad values also.
- cryptonector 5y agoSure, you can treat I/O functions as World -> World functions, but unlike other pure functions, the compiler can't compute them at compile time when they are applied to constant inputs. A program consisting entirely of pure function applications to constants can be evaluated at compile-time to just the constant(s) it would output, while a program that calls I/O functions cannot be (assuming those calls to I/O functions are not dead code).