4 ms·
You're right that Haskell doesn't distinguish different IO actions other than by the type they return. There are certainly libraries that do this though, althou
by sordina 12y ago
You're right that Haskell doesn't distinguish different IO actions other than by the type they return. There are certainly libraries that do this though, although they aren't widely used.
Even though Haskell doesn't distinguish different classes of IO actions, it still distinguishes IO actions from other kinds of actions (such as stateful actions as per your example), and pure computations and that provides a hell of a lot of bang for buck.
The Idris language has the notion of effect types [1] to make achieving the goal of categorising the kinds of effects being used in a function easier to deal with, but that uses the dependent capabilities of the language.
[1] http://eb.host.cs.st-andrews.ac.uk/drafts/eff-tutorial.pdf http://eb.host.cs.st-andrews.ac.uk/drafts/eff-tutorial.pdf
- tel 12y ago> Not widely used... I use them in every single application I write, or I make my own tighter, more specific ones. They're incredibly useful in real world apps.
- sordina 12y agoSorry Tel, I didn't mean to imply that nobody uses them, more that I would guess that they are used less than 1% of the time where their inclusion could be beneficial.
- tel 12y agoHa, no offense. I just wanted to emphasize that they are used. In particular, I think they're more useful in applications than libraries and most Haskell code you can find in the wild is library code---so you end up not seeing them much.