External Publication
Visit Post

Haskell's missing mutable reference type

Haskell Community [Unofficial] June 13, 2026
Source

tomjaguarpaw:

In which case, the response would be that the lexical scoping way is not sufficient to integrate with libFun

Yes, that is what I was asking for thanks!

Okay, I don’t disagree that the IOScopedRef API allows APIs that aren’t possible without it, but I’m still not convinced that those APIs are useful. Your libFun example is techinically an example where they are necessary, because it’s basically a function that takes something with your exact API as a parameter. But then the question is: are there real functions that look like libFun? I can’t think of any but maybe you know some?

In particular, the exact constraint libFun has that’s relevant here is that it takes a function from IO _ -> IO _, where this function has to act on exactly IO.

If you generalized it to work on any m that implements MonadIO (Or MonadUnliftIO), you wouldn’t need IOScopedRefs because you could instantiate m with ReaderT Logger IO

Discussion in the ATmosphere

Loading comments...