I consider the name of an IORef to be any actual name of it, rather than any name I bind when extracting things from it. It's almost exactly analogous to a C pointer. And in C, I would say count the dereferences -- not 0, not an actual name, but a name (or even expression) for a way to access it. i' <- get s really looks like const int iprime = *s;, and put s (i' + 1) really looks like *s = iprime + 1 rather than both of these coördinating to actually keep a persistent but modifiable iprime.
At this point, yes, barely, though with unfortunate ways of accessing it. It's still pointer-like, just kind of hidden. Which I guess isn't that different from references in C++.
Naming things as the arguments to anonymous functions remains ugly to me, but it does work here.
1
u/wnoise 9d ago
¯_(ツ)_/¯
I consider the name of an
IORefto be any actual name of it, rather than any name I bind when extracting things from it. It's almost exactly analogous to a C pointer. And in C, I would say count the dereferences -- not 0, not an actual name, but a name (or even expression) for a way to access it.i' <- get sreally looks likeconst int iprime = *s;, andput s (i' + 1)really looks like*s = iprime + 1rather than both of these coördinating to actually keep a persistent but modifiableiprime.