External Publication
Visit Post

Haskell's missing mutable reference type

Haskell Community [Unofficial] June 18, 2026
Source

tobz619:

I’m not quite reading why you want to do this over reading the value from the IORef just before passing that value as a parameter to your local thread?

That’s a similar transformation to the one proposed by @prophet and @BurningWitness in this thread. My response is this: Haskell's missing mutable reference type - #7 by tomjaguarpaw.

Basically, your transformation works when you can see the refs that you need to clone. If you can’t, you don’t know that you need to clone them!

I changed the concurrency example to try to make this a bit clearer. Have a look at writeUserDataConcurrently. How would you write it using your proposed transformation? I bet you can’t!

Since the same idea has come up three times now in slightly different forms it’s clearly an important one to address. Can you think of a way I can make it more obvious, or do you have any further questions about it I can help resolve?

Discussion in the ATmosphere

Loading comments...