Documentation

Init.Data.Option.Basic

def Option.toMonad {m : Type u_1Type u_2} {α : Type u_1} [inst : Monad m] [inst : Alternative m] :
Option αm α
Equations
@[inline]
def Option.toBool {α : Type u_1} :
Option αBool
Equations
@[inline]
def Option.isSome {α : Type u_1} :
Option αBool
Equations
@[inline]
def Option.isNone {α : Type u_1} :
Option αBool
Equations
@[inline]
def Option.isEqSome {α : Type u_1} [inst : BEq α] :
Option ααBool
Equations
  • Option.isEqSome _fun_discr _fun_discr = match _fun_discr, _fun_discr with | some a, b => a == b | none, x => false
@[inline]
def Option.bind {α : Type u_1} {β : Type u_2} :
Option α(αOption β) → Option β
Equations
  • Option.bind _fun_discr _fun_discr = match _fun_discr, _fun_discr with | none, x => none | some a, b => b a
@[inline]
def Option.map {α : Type u_1} {β : Type u_2} (f : αβ) (o : Option α) :
Equations
@[inline]
def Option.mapM {m : Type u_1Type u_2} {α : Type u_3} {β : Type u_1} [inst : Monad m] (f : αm β) (o : Option α) :
m (Option β)
Equations
theorem Option.map_id {α : Type u_1} :
Equations
@[inline]
def Option.filter {α : Type u_1} (p : αBool) :
Option αOption α
Equations
@[inline]
def Option.all {α : Type u_1} (p : αBool) :
Option αBool
Equations
  • Option.all p _fun_discr = match _fun_discr with | some a => p a | none => true
@[inline]
def Option.any {α : Type u_1} (p : αBool) :
Option αBool
Equations
  • Option.any p _fun_discr = match _fun_discr with | some a => p a | none => false
@[macroInline]
def Option.orElse {α : Type u_1} :
Option α(UnitOption α) → Option α
Equations
  • Option.orElse _fun_discr _fun_discr = match _fun_discr, _fun_discr with | some a, x => some a | none, b => b ()
instance Option.instOrElseOption {α : Type u_1} :
Equations
  • Option.instOrElseOption = { orElse := Option.orElse }
@[inline]
noncomputable def Option.lt {α : Type u_1} (r : ααProp) :
Option αOption αProp
Equations
  • Option.lt r _fun_discr _fun_discr = match _fun_discr, _fun_discr with | none, some val => True | some x, some y => r x y | x, x_1 => False
instance Option.instDecidableRelOptionLt {α : Type u_1} (r : ααProp) [s : DecidableRel r] :
Equations
instance instDecidableEqOption :
{α : Type u_1} → [inst : DecidableEq α] → DecidableEq (Option α)
Equations
  • instDecidableEqOption = [anonymous]
instance instBEqOption :
{α : Type u_1} → [inst : BEq α] → BEq (Option α)
Equations
  • instBEqOption = { beq := [anonymous] }
instance instLTOption {α : Type u_1} [inst : LT α] :
LT (Option α)
Equations
  • instLTOption = { lt := Option.lt fun a a_1 => a < a_1 }
Equations
Equations
Equations
def liftOption {m : Type u_1Type u_2} {α : Type u_1} [inst : Alternative m] :
Option αm α
Equations
@[inline]
def Option.tryCatch {α : Type u_1} (x : Option α) (handle : UnitOption α) :
Equations
Equations