def
Option.toMonad
{m : Type u_1 → Type u_2}
{α : Type u_1}
[Monad m]
[Alternative m]
:
Option α → m α
Equations
- Option.toMonad x = match x with | none => failure | some a => pure a
Instances For
@[inline]
Equations
- Option.toBool x = match x with | some val => true | none => false
Instances For
@[inline]
Equations
- Option.isSome x = match x with | some val => true | none => false
Instances For
@[inline]
Equations
- Option.isNone x = match x with | some val => false | none => true
Instances For
@[inline]
Equations
- Option.isEqSome x x = match x, x with | some a, b => a == b | none, x => false
Instances For
@[inline]
Equations
- Option.bind x x = match x, x with | none, x => none | some a, b => b a
Instances For
Equations
- One or more equations did not get rendered due to their size.
Take a pair of options and if they are both some
, apply the given fn to produce an output.
Otherwise act like orElse
.
Equations
Instances For
Equations
- instDecidableEqOption = decEqOption✝
@[always_inline]
Equations
- instFunctorOption = { map := fun {α β} => Option.map, mapConst := fun {α β} => Option.map ∘ Function.const β }
@[always_inline]
Equations
- instAlternativeOption = Alternative.mk (fun {α} => none) fun {α} => Option.orElse
Equations
- liftOption x = match x with | some a => pure a | none => failure
Instances For
Equations
- instMonadExceptOfUnitOption = { throw := fun {α} x => none, tryCatch := fun {α} => Option.tryCatch }