Skip to content

Draft: Define one-shot EtaReaderT, use it in IOEnv (#19380)

Sebastian Graf requested to merge wip/eta-reader-t into master

In #19380 we discuss how we can hide the Note [The one-shot state monad trick] behind a re-usable set of monad transformers replicating ReaderT, StateT, etc.

This patch introduces GHC.Utils.Monad.EtaReaderT and uses it to implement IOEnv, the implementation of which no longer needs to be aware of the one-shot monad trick.

A first step toward resolving #19380. The ultimate goal is to upstream EtaReaderT back to transformers, but we can play around with it now in GHC to experience the implications of using it.

Edited by Andreas Klebinger

Merge request reports