Mathlib Map

Structures · Lean core

Monad

[Monads](https://en.wikipedia.org/wiki/Monad_(functional_programming)) are an abstraction of sequential control flow and side effects used in functional programming. Monads allow both sequencing of effects and data-dependent effects: the values that result from an early step may influence the effects carried out in a later step. The Monad API may be used directly. However, it is most commonly accessed through [do-notation](https://lean-lang.org/doc/reference/4.33.0/find/?domain=Verso.Genre.Manual.section&name=do-notation). Most Monad instances provide implementations of pure and bind, and use default implementations for the other methods inherited from Applicative. Monads should satisfy certain laws, but instances are not required to prove this. An instance of LawfulMonad expresses that a given monad's operations are lawful.

Defined in
Init.Prelude
Shape
One type argument

Extends2

Extended by1

Forgetful instances

Every Monad is also a

Concrete types that are instances66

  • FreeAbelianGroup
  • FreeGroup
  • FreeAddGroup
  • MvPolynomial
  • Part
  • ReaderT
  • StateT
  • Except
  • StateRefT'
  • OptionT
  • Ultrafilter
  • Lean.Core.CoreM
  • ExceptT
  • Lean.Elab.Command.CommandElabM
  • Semiquot
  • PFun
  • FreeMagma
  • EStateM
  • FreeSemigroup
  • EIO
  • Lean.Elab.Term.TermElabM
  • FreeAddMagma
  • Lean.Meta.MetaM
  • FreeAddSemigroup
  • ST
  • Computation
  • Std.Async.ContextAsync
  • EST
  • BaseIO
  • Stream'.Seq1
  • Std.Internal.Do.PredTrans
  • Std.Iterators.PostconditionT
  • Erased
  • Lean.Elab.Tactic.TacticM
  • Lean.MonadCacheT
  • Std.Do.PredTrans
  • ContT
  • WriterT
  • Std.Iterators.HetT
  • Stream'.WSeq
  • Std.Async.EAsync
  • PMF
  • ExceptCpsT
  • StateCpsT
  • Std.Internal.Parsec
  • Lean.Elab.Tactic.Grind.GrindTacticM
  • Std.Async.BaseAsync
  • Std.Iterators.ULiftT
  • Lean.MonadStateCacheT
  • Std.Async.MaybeTask
  • Aesop.TreeM
  • Std.Async.ETask
  • Aesop.SearchM
  • Aesop.ElabM
  • Aesop.EqualUpToIdsM
  • ULift
  • Sum
  • List
  • WithZero
  • Multiset
  • Finset
  • Option
  • PLift
  • WithOne
  • Id
  • Trunc

How is a type an instance?

Loading the hierarchy index…

Assumed by181

Ancestors11