2 ms·
Such a function is perfectly allowed and even encouraged, see here where I allocate a mutable array with undefined values and write and read from it in a pure f
by rowanG077 5y ago
Such a function is perfectly allowed and even encouraged, see here where I allocate a mutable array with undefined values and write and read from it in a pure function. Basically replicating the pseudo imperative code I have written before:
https://replit.com/@RowanGoemans/QuarrelsomeUtilizedMicrokernel#Main.hs:11:10 https://replit.com/@RowanGoemans/QuarrelsomeUtilizedMicroker...
Using mutable vectors like this is a must if you need to write high performance Haskell code.
I have also written concrete code for magicalhippo in another branch of this thread.
- jiggawatts 5y agoThat's a clever hack that was added decades after I learned Haskell. I mean... it works, but it's not in the spirit of Haskell, which is my point. It's not impossible to write pure functional software in C. It just goes against its grain.
- rowanG077 5y agoMonadic computations are very much in the spirit of Haskell. I don't think the Haskell community view the ST monad as a hack. It's one of many tools in the box of any Haskell programmer.