4 ms·
He means Haskell-grade types (float->float is not a function touching the IO monad). It wouldn't help in any mainstream language with actual types (like C++).
by H8crilA 7y ago
He means Haskell-grade types (float->float is not a function touching the IO monad). It wouldn't help in any mainstream language with actual types (like C++).
- mpeg 7y agoRight, that makes sense, I always thought that had more to do with the pure functional nature of Haskell than the type system, but I've never written any Haskell.
- picozeta 7y agoFrom a certain point of view that is the same thing. A pure function can only enforced using a powerful type system. Otherwise one could argue, your types are "lying". EDIT: 's/strong/powerful'
- baddox 7y agoAssuming that the function was called with a string, but the window.print function doesn't accept a string argument, the typing systems in mainstream languages like Java (or even TypeScript) would catch this bug.
- edflsafoiewq 7y agoIt's not the Math.Round function in the source text that's doing IO. IO is done as part of the function that gets run when you click "Run" run : DotNetCode -> IO () Doing IO is expected for this function (not only might the source code to be executed do IO, but the print function that was intended to be called instead of window.print certainly would).
- bradstewart 7y agoWow this suddenly made "get" the power of Haskell, which has escaped me for quite a while (not that I've ever actually written anything real with it). You can capture side effects _in the type system_. That is honestly brilliant.