4 ms·
> it takes away your ability to arbitrarily mutate state and perform IO No. Haskell requires that you declare where IO is allowed (via the type). Once you ass
by dons 14y ago
> it takes away your ability to arbitrarily mutate state and perform IO
No. Haskell requires that you declare where IO is allowed (via the type). Once you assert that you admit mutable state (ST) or arbtirary IO (IO), then you are free to use them.
- polymatter 14y agoIn fairness, Haskell makes it more awkward to deal in mutable state and arbitrary IO. Like how not using goto in a more mainstream language makes it more awkward to have arbitrary control flow. Debugging is annoying when I can't stick a println or puts in any arbitrary function. (The solution of course is to have small functions and print them. If your Haskell function is over 20 lines long you're probably doing it wrong.) Of course, Haskell also means if your program compiles, 90% of the time it runs fine. I love that about it. (Unit tests are still required for the things the compiler can't catch, but its a major win regardless)
- dons 14y ago> Debugging is annoying when I can't stick a println You might not know about Debug.Trace? http://www.haskell.org/ghc/docs/latest/html/libraries/base/Debug-Trace.html#v:trace http://www.haskell.org/ghc/docs/latest/html/libraries/base/D...
- polymatter 14y agoThanks very much! Thats just what I wanted :)