Re:Math.Round opens the browser print dialog
by H8crilA on Wednesday June 19, 2019 @08:03PM
(#20228583)
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++).
[ Parent
| on HN ]
Re:Math.Round opens the browser print dialog
by edflsafoiewq on Wednesday June 19, 2019 @08:45PM
(#20228784)
It'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).
Re:Math.Round opens the browser print dialog
by baddox on Wednesday June 19, 2019 @08:39PM
(#20228753)
Assuming 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.
Re:Math.Round opens the browser print dialog
by mpeg on Wednesday June 19, 2019 @08:16PM
(#20228647)
Right, 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.
Re:Math.Round opens the browser print dialog
by picozeta on Wednesday June 19, 2019 @08:21PM
(#20228666)
From 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'
Re:Math.Round opens the browser print dialog
by bradstewart on Thursday June 20, 2019 @11:14AM
(#20233711)
Wow 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.