purescript-contrib/purescript-arraybuffer

why do Getter results live in Eff?

matthewleon opened this issue · 4 comments

These should be safe, read-only operations. Is wrapping the result in Eff necessary?

I'm not sure about this. Could the compiler, in a case like this:

DV.setUint8 dv 0 123
let a = DV.getUint8 dv 0
DV.setUint8 dv 0 456
let b = DV.getUint8 dv 0

be free to reorder the getters in a way that yields unexpected results for that code?

Ah I see. I think the issue here might be that what these Effs are doing is ST type stuff.

I'm working on a fork of this where I adopt the approach used here: https://pursuit.purescript.org/packages/purescript-arrays/4.0.1/docs/Data.Array.ST

I think that might be fruitful.

Great, freeze/thaw seems the way to go.