External Publication
Visit Post

Haskell's missing mutable reference type

Haskell Community [Unofficial] June 13, 2026
Source

danidiaz:

In my personal projects, I prefer to work with bare IO instead of usign an app-wide ReaderT

You could still do that! It’s only that when using libFun, you would locally instantiate that m with ReaderT Logger IO, which (modulo newtypes) would give you

libFun ::
  (String -> Logger -> IO ()) ->
  (forall r. Int -> (Logger -> IO ()) -> Logger -> IO ()) ->
  Logger -> IO ()

which is exactly the type you would want for the non-IOScopedRef API

danidiaz:

it’s convenient as an alternative to ReaderT

The problem is that it’s not an alternative because you still need to pass the IOScopedRef into whatever wants to access it

Discussion in the ATmosphere

Loading comments...