3 ms·
It's incredibly rare that the problem you are trying to solve requires that you alloc an array and modify values in place, instead of something else that gives
by marcosdumay 9y ago
It's incredibly rare that the problem you are trying to solve requires that you alloc an array and modify values in place, instead of something else that gives you the same result. Haskell is normally not suited for those cases anyway, because of stop-the-world garbage collection and hard to predict performance.
But, if you want to do that anyway, there's IOArray. You will just have to program everything on IO, and will get an executable that inherits the ordering of your code like any imperative language. Yet, way more often than not, people that think they have that problem just want to write C/Java/watever code in Haskell and have no good reason for dictating every detail of the machine behavior.
- dllthomas 9y ago> You will just have to program everything on IO Sort of, but I think this misleads a little bit. You will have to program your manipulation of the array in IO, and thus anything using the actions manipulating the array. Intermediate computations could be outside IO. And of course there's also ST.