File: Mathlib/Control/Monad/Writer.lean

full_name: WriterT
code: def WriterT (ω : Type u) (M : Type u → Type v) (α : Type u) : Type v 
goal: Type v

full_name: Writer
code: abbrev Writer ω 
goal: Type u_1

full_name: MonadWriter.tell
code: class MonadWriter (ω : outParam (Type u)) (M : Type u → Type v) where
  tell : ω → M PUnit
  listen {α} : M α → M (α × ω)
  pass {α} : M (α × (ω → ω)) → M α
goal: ω → M PUnit.{u + 1}

full_name: MonadWriter
code: class MonadWriter (ω : outParam (Type u)) (M : Type u → Type v) where
  tell : ω → M PUnit
  listen {α} : M α → M (α × ω)
  pass {α} : M (α × (ω → ω)) → M α
goal: Type (max (u + 1) v)

full_name: MonadWriter.pass
code: class MonadWriter (ω : outParam (Type u)) (M : Type u → Type v) where
  tell : ω → M PUnit
  listen {α} : M α → M (α × ω)
  pass {α} : M (α × (ω → ω)) → M α
goal: M (α × (ω → ω)) → M α

full_name: MonadWriter.listen
code: class MonadWriter (ω : outParam (Type u)) (M : Type u → Type v) where
  tell : ω → M PUnit
  listen {α} : M α → M (α × ω)
  pass {α} : M (α × (ω → ω)) → M α
goal: M α → M (α × ω)

full_name: instMonadWriterReaderT
code: instance [MonadWriter ω M] : MonadWriter ω (ReaderT ρ M) 
goal: MonadWriter ω (ReaderT ρ M)

full_name: instMonadWriterStateTOfMonad
code: instance [Monad M] [MonadWriter ω M] : MonadWriter ω (StateT σ M) 
goal: MonadWriter ω (StateT σ M)

full_name: WriterT.mk
code: @[inline]
protected def mk {ω : Type u} (cmd :  M (α × ω)) : WriterT ω M α 
goal: WriterT ω M α

full_name: WriterT.run
code: @[inline]
protected def run {ω : Type u} (cmd : WriterT ω M α) : M (α × ω) 
goal: M (α × ω)

full_name: WriterT.runThe
code: @[inline]
protected def runThe (ω : Type u) (cmd : WriterT ω M α) : M (α × ω) 
goal: M (α × ω)

full_name: WriterT.ext
code: @[ext]
protected theorem ext {ω : Type u} (x x' : WriterT ω M α) (h : x.run = x'.run) : x = x' 
goal: x = x'

full_name: WriterT.monad
code: /-- Creates an instance of Monad, with an explicitly given empty and append operation.

Previously, this would have used an instance of `[Monoid ω]` as input.
In practice, however, WriterT is used for logging and creating lists so restricting to
monoids with `Mul` and `One` can make `WriterT` cumbersome to use.

This is used to derive instances for both `[EmptyCollection ω] [Append ω]` and `[Monoid ω]`.
-/
@[reducible, inline]
def monad (empty : ω) (append : ω → ω → ω) : Monad (WriterT ω M) 
goal: Monad (WriterT ω M)

full_name: WriterT.liftTell
code: /-- Lift an `M` to a `WriterT ω M`, using the given `empty` as the monoid unit. -/
@[inline]
protected def liftTell (empty : ω) : MonadLift M (WriterT ω M) 
goal: MonadLift M (WriterT ω M)

full_name: WriterT.instMonadOfEmptyCollectionOfAppend
code: instance [EmptyCollection ω] [Append ω] : Monad (WriterT ω M) 
goal: Monad (WriterT ω M)

full_name: WriterT.instMonadLiftOfEmptyCollection
code: instance [EmptyCollection ω] : MonadLift M (WriterT ω M) 
goal: MonadLift M (WriterT ω M)

full_name: WriterT.instMonadOfMonoid
code: instance [Monoid ω] : Monad (WriterT ω M) 
goal: Monad (WriterT ω M)

full_name: WriterT.instMonadLiftOfMonoid
code: instance [Monoid ω] : MonadLift M (WriterT ω M) 
goal: MonadLift M (WriterT ω M)

full_name: WriterT.instLawfulMonad
code: instance [Monoid ω] [LawfulMonad M] : LawfulMonad (WriterT ω M) 
goal: LawfulMonad (WriterT ω M)

full_name: WriterT.instMonadWriter
code: instance : MonadWriter ω (WriterT ω M) 
goal: MonadWriter ω (WriterT ω M)

full_name: WriterT.instMonadExcept
code: instance {ε : Type*} [MonadExcept ε M] : MonadExcept ε (WriterT ω M) 
goal: MonadExcept ε (WriterT ω M)

full_name: WriterT.instMonadControlOfMonadLiftT
code: instance [MonadLiftT M (WriterT ω M)] : MonadControl M (WriterT ω M) 
goal: MonadControl M (WriterT ω M)

full_name: WriterT.instMonadFunctor
code: instance : MonadFunctor M (WriterT ω M) 
goal: MonadFunctor M (WriterT ω M)

full_name: WriterT.adapt
code: @[inline] protected def adapt {ω' : Type u} {α : Type u} (f : ω → ω') :
    WriterT ω M α → WriterT ω' M α 
goal: WriterT ω M α → WriterT ω' M α

full_name: MonadWriterAdapter
code: /-- Adapt a monad stack, changing the type of its top-most environment.

This class is comparable to [Control.Lens.Magnify](https://hackage.haskell.org/package/lens-4.15.4/docs/Control-Lens-Zoom.html#t:Magnify),
but does not use lenses (why would it), and is derived automatically for any transformer
implementing `MonadFunctor`.
-/
class MonadWriterAdapter (ω : outParam (Type u)) (m : Type u → Type v) where
  adaptWriter {α : Type u} : (ω → ω) → m α → m α
goal: Type (max (u + 1) v)

full_name: MonadWriterAdapter.adaptWriter
code: /-- Adapt a monad stack, changing the type of its top-most environment.

This class is comparable to [Control.Lens.Magnify](https://hackage.haskell.org/package/lens-4.15.4/docs/Control-Lens-Zoom.html#t:Magnify),
but does not use lenses (why would it), and is derived automatically for any transformer
implementing `MonadFunctor`.
-/
class MonadWriterAdapter (ω : outParam (Type u)) (m : Type u → Type v) where
  adaptWriter {α : Type u} : (ω → ω) → m α → m α
goal: (ω → ω) → m α → m α

full_name: monadWriterAdapterTrans
code: /-- Transitivity.

see Note [lower instance priority] -/
instance (priority := 100) monadWriterAdapterTrans {n : Type u → Type v}
    [MonadWriterAdapter ω m] [MonadFunctor m n] : MonadWriterAdapter ω n 
goal: MonadWriterAdapter ω n

full_name: instMonadWriterAdapterWriterTOfMonad
code: instance [Monad m] : MonadWriterAdapter ω (WriterT ω m) 
goal: MonadWriterAdapter ω (WriterT ω m)

full_name: WriterT.equiv
code: /-- reduce the equivalence between two writer monads to the equivalence between
their underlying monad -/
def WriterT.equiv {m₁ : Type u₀ → Type v₀} {m₂ : Type u₁ → Type v₁}
    {α₁ ω₁ : Type u₀} {α₂ ω₂ : Type u₁} (F : (m₁ (α₁ × ω₁)) ≃ (m₂ (α₂ × ω₂))) :
    WriterT ω₁ m₁ α₁ ≃ WriterT ω₂ m₂ α₂ 
goal: WriterT ω₁ m₁ α₁ ≃ WriterT ω₂ m₂ α₂