Zulip Chat Archive
Stream: lean4
Topic: Reader and local
David Thrane Christiansen (Nov 30 2022 at 21:50):
The documentation for MonadReaderOf
states:
An implementation of [`MonadReader`]. It does not contain `local` because this
function cannot be lifted using `monadLift`. Instead, the `MonadReaderAdapter`
class provides the more general `adaptReader` function.
And indeed, there is no local
.
However, grepping the Lean 4 source doesn't find any occurrences of adaptReader
other than this doc comment.
I have two questions:
- Where can I learn more about
adaptReader
? Locally overriding aReader
effect is a highly useful thing to do, after all! - If I need to use something like
local
, is there a better way to do it than by defining my own MTL-style instance pile?
Thanks!
Jannis Limperg (Nov 30 2022 at 21:53):
I think you're looking for withReader
.
David Thrane Christiansen (Dec 01 2022 at 08:52):
Ah, great, it's a docs bug! I'll open an issue.
David Thrane Christiansen (Dec 01 2022 at 09:02):
And thanks :-)
Sebastian Ullrich (Dec 01 2022 at 09:16):
Fixed, thanks!
Sebastian Ullrich (Dec 01 2022 at 09:25):
Oops, too slow
David Thrane Christiansen (Dec 01 2022 at 09:27):
All good :-)
Last updated: Dec 20 2023 at 11:08 UTC