I found this wrapper code around Text.PrettyPrint.HughesPJ to be useful when wishing to do IO operations in the course of pretty-printing. It allows the pretty-printing combinators to be used in much the same way as before, but also allows lifted operations to be called for things such as db lookups.
Although this code seems generally useful to me, I'm not sure whether it belongs in haskell-proper, or in a separate library. Please let me know what you suggest.
Also, I'm not sure whether the PP type should be exposed as a synonym for ReaderT as it is now, whether ReaderT should be hidden in some way, or just used directly in the interface.
Added documentation for PP.
Cool. I am snowed under right now so may be a two - three weeks before I can look at this seriously. The code looks fine on first glance though, just need to make sure I think it's right to include in the package this kind of functionality.
I can do this myself but in general try to just provide one cleanly named patch.
Sorry for the long delay here. I may get some time to look at it this week. Otherwise go ahead and release as its own package and I can always pull it into pretty at a later date when I've evaluated it more. So just let me know.
Going to close this PR as it's been a while now. I also think this is probably better released as it's own package and not core enough for including in pretty. Thanks for the code though!