So, I’m guessing the use case here is that you have a computation that already somehow captures the IOScopedRef, as in
do
ref <- newIOScopedRef 0
let printCurrent = do
current <- readIOScopedRef ref
print current
modifyScopedIORef ref (+1) do
...
printCurrent -- implicitly uses the captured 'ref'
(otherwise I’m not sure how this would be different from just using a regular variable and shadowing it)
Do you have an example where this is useful to have?