You can see what effects any block of code has.
That’s indeed useful, but you can have it in ReaderT-like approaches too. I wondered about that in this other thread.
Like, imagine that you have a record like
data Repository m = Repository
{ findById :: ResourceId -> m Resource,
save :: Resource -> m ()
}
And a constructor that uses a Has
-like class to find its dependencies in a dependency injection environment:
makeRepository :: (Has Logger m deps, Has SomeOtherDep m deps)
=> deps -> Repository m
makeRepository = undefined
That seems roughly analogous to an effectful
interpreter for some Repository
effect that delegates on the Logger
and SomeOtherDep
effects.
Maybe it’s a question of taste, but maybe there are other benefits in the effectful
way.