43 karma · joined November 2, 2024
The compiler can't. It is up to the programmer to make sure that a database effect doesn't, say for sake of example, write out to a file also.
So in the end this is just a novel new way to organise code.
What is the order of sumNToTotal?
>well, you point out the analysis of its flaws from the effectful documentation. That's correct.
Thinking deeper about this, that there is essentially no way to fix this issue with StateT, because of the type choice, the monad, the composability requirement, all conspiring together to not be undone, does that signal something deeper that is wrong with the flexibility of Haskell, that we can progressively paint ourselves into a corner like this. Could it not happen again, but with another late breaking requirement, for effectful, or bluefin?
This explains in more detail:
https://github.com/haskell-effectful/effectful/blob/master/t...
I agree loosely with what haskman above says about creating relatively bug free applications, the guard rails are so robust. But those same guard rails mean you can paint yourself into a corner that it is harder to get out of without imperative state, case in point above.