External Publication
Visit Post

Haskell's missing mutable reference type

Haskell Community [Unofficial] June 14, 2026
Source

prophet:

You could still do that! It’s only that when using libFun, you would locally instantiate that m with ReaderT Logger IO

IIUC, wouldn’t that force you to make libFun polymorphic over the monad?

prophet:

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

When I build the graph of components for my application during initialization, I’m ok with passing the ref to any component that uses it directly, like the Repository in my example. What I don’t want is having to pass it to the components that depend on Repository. Like this component which uses the repository but doesn’t need to know about the connection or how it’s obtained.

Discussion in the ATmosphere

Loading comments...