External Publication
Visit Post

Haskell's missing mutable reference type

Haskell Community [Unofficial] June 14, 2026
Source

modifications to an IOScopedRef in one thread would not be observed by another thread

Do you mean any other thread or would child threads see it? I’m pretty sure that’s what you would want, otherwise your logging example gets very annoying as soon as you do any concurrency inside a modification block.

In fact, it seems to me that this is the crux of it rather than a thread-local variable, its a thread-and-children-local-variable. The “scoped” part of your proposal can be achieved by just forking a child thread before doing the modification!

Discussion in the ATmosphere

Loading comments...