Cslib.FreeM.FreeWriter
abbrevimported Lean
Writer monad implemented via the FreeM monad construction. This provides a more efficient implementation than the traditional WriterT transformer, as it avoids buffering the log.
Statement
set_option autoImplicit true in set_option relaxedAutoImplicit true in universe u v w w' w'' in abbrev Cslib.FreeM.FreeWriter (ω : Type u)
- Defined in
- CSLib, `Cslib.FreeM.FreeWriter`
- Lean proof
- By Tanner Duve, from github.com/leanprover/cslib at
3951377e5a3f(Copyright (c) 2025 Tanner Duve. All rights reserved, Apache-2.0). Compiled here against leanprover/lean4:v4.33.1, Mathlib v4.33.1; written for leanprover/lean4:v4.33.0.Cslib.FreeM.FreeWriter← Cslib.FreeM.FreeWriter (Cslib/Foundations/Control/Monad/Free/Effects.lean:172): verbatim
- Verified
- 08 Oct 2026
- Axioms
- none listed
- Built on 8
- Cslib.FreeM.WriterFType constructor for writer operations. Writer has a single effect, so the definition has just one constructor.
- Cslib.FreeM.instMonadCslib.FreeM.instMonad
- Cslib.FreeM.instFunctorCslib.FreeM.instFunctor
- Cslib.FreeM.instLawfulFunctorCslib.FreeM.instLawfulFunctor
- Cslib.FreeM.instBindCslib.FreeM.instBind
- Cslib.FreeM.instLawfulMonadCslib.FreeM.instLawfulMonad
- Cslib.FreeM.instPureCslib.FreeM.instPure
- Cslib.FreeMThe Free monad over a type constructor
F. AFreeM F ais a tree of operations from the type constructorF, with leaves of typea.…
- Used by 16
- Cslib.FreeM.FreeWriter.writerInterpInterpret
WriterFoperations intoWriterT. - Cslib.FreeM.FreeWriter.pass_defCslib.FreeM.FreeWriter.pass_def
- Cslib.FreeM.FreeWriter.runInterprets a
FreeWritercomputation by recursively traversing the tree, accumulating log entries with the monoid operation, and returns… - Cslib.FreeM.FreeWriter.tellWrites a log entry. This creates an effectful node in the computation tree.
- Cslib.FreeM.FreeWriter.tell_defCslib.FreeM.FreeWriter.tell_def
- Cslib.FreeM.FreeWriter.pass
passallows a subcomputation to modify its own log. After traversing the computation and accumulating its log, the resulting function is… - Cslib.FreeM.FreeWriter.run_lift_tellCslib.FreeM.FreeWriter.run_lift_tell
- Cslib.FreeM.FreeWriter.run_bindCslib.FreeM.FreeWriter.run_bind
- Cslib.FreeM.FreeWriter.listen_pureCslib.FreeM.FreeWriter.listen_pure
- Cslib.FreeM.FreeWriter.run_pureCslib.FreeM.FreeWriter.run_pure
- Cslib.FreeM.FreeWriter.listen
listencaptures the log produced by a subcomputation incrementally. It traverses the computation, emitting log entries as encountered,… - Cslib.FreeM.FreeWriter.instMonadWriterOfMonoidCslib.FreeM.FreeWriter.instMonadWriterOfMonoid
- Cslib.FreeM.FreeWriter.listen_lift_tell_bindCslib.FreeM.FreeWriter.listen_lift_tell_bind
- Cslib.FreeM.FreeWriter.toWriterTConvert a
FreeWritercomputation into aWriterTcomputation. This is the canonical interpreter derived fromliftM. - Cslib.FreeM.FreeWriter.run_toWriterTThe canonical interpreter
toWriterTderived fromliftMagrees with the hand-written recursive interpreterrunforFreeWriter. - Cslib.FreeM.FreeWriter.toWriterT_unique
toWriterTis the unique interpreter extendingwriterInterp.
- Cslib.FreeM.FreeWriter.writerInterpInterpret
Lean source view module on GitHub
set_option autoImplicit true in set_option relaxedAutoImplicit true in universe u v w w' w'' in /-- Writer monad implemented via the `FreeM` monad construction. This provides a more efficient implementation than the traditional `WriterT` transformer, as it avoids buffering the log. -/ abbrev Cslib.FreeM.FreeWriter (ω : Type u) := FreeM (WriterF ω)