Module docstring
{"# Monad combinators, as in Haskell's Control.Monad. "}
{"# Monad combinators, as in Haskell's Control.Monad. "}
joinM
definition
{m : Type u → Type u} [Monad m] {α : Type u} (a : m (m α)) : m α
when
definition
{m : Type → Type} [Monad m] (c : Prop) [Decidable c] (t : m Unit) : m Unit
condM
definition
{m : Type → Type} [Monad m] {α : Type} (mbool : m Bool) (tm fm : m α) : m α
/-- Executes `tm` or `fm` depending on whether the result of `mbool` is `true` or `false`
respectively. -/
def condM {m : Type → Type} [Monad m] {α : Type} (mbool : m Bool) (tm fm : m α) : m α := do
let b ← mbool
cond b tm fm
whenM
definition
{m : Type → Type} [Monad m] (c : m Bool) (t : m Unit) : m Unit
Monad.mapM
definition
@[deprecated List.mapM (since := "2025-04-07"), inherit_doc List.mapM]
def mapM :=
@List.mapM
Monad.mapM'
definition
@[deprecated List.mapM' (since := "2025-04-07"), inherit_doc List.mapM']
def mapM' :=
@List.mapM'
Monad.join
definition
Monad.filter
definition
@[deprecated List.filterM (since := "2025-04-07"), inherit_doc List.filterM]
def filter :=
@List.filterM
Monad.foldl
definition
@[deprecated List.filterM (since := "2025-04-07"), inherit_doc List.foldlM]
def foldl :=
@List.filterM
Monad.cond
definition
Monad.sequence
definition
{m : Type u → Type v} [Monad m] {α : Type u} : List (m α) → m (List α)
/-- Executes a list of monadic actions in sequence, collecting the results. -/
@[deprecated "Use `_root_.sequence` instead." (since := "2025-04-07")]
def sequence {m : Type u → Type v} [Monad m] {α : Type u} : List (m α) → m (List α)
| [] => return []
| h :: t => do
let h' ← h
let t' ← sequence t
return (h' :: t')
Monad.sequence'
definition
{m : Type → Type u} [Monad m] {α : Type} : List (m α) → m Unit
Monad.whenb
definition
{m : Type → Type} [Monad m] (b : Bool) (t : m Unit) : m Unit
/-- Executes `t` if `b` is `true`, doing nothing otherwise.
See also `when` and `whenM`. -/
@[deprecated "Use `if ... then` without `else` in `do` notation instead." (since := "2025-04-07")]
def whenb {m : Type → Type} [Monad m] (b : Bool) (t : m Unit) : m Unit :=
_root_.cond b t (return ())
Monad.unlessb
definition
{m : Type → Type} [Monad m] (b : Bool) (t : m Unit) : m Unit