Equations
- OptionT.mk x = x
Instances For
@[inline]
def
OptionT.bind
{m : Type u → Type v}
[Monad m]
{α : Type u}
{β : Type u}
(x : OptionT m α)
(f : α → OptionT m β)
:
OptionT m β
Equations
- OptionT.bind x f = OptionT.mk do let __do_lift ← x match __do_lift with | some a => f a | none => pure none
Instances For
Equations
- OptionT.instAlternativeOptionT = Alternative.mk (fun {α} => OptionT.fail) fun {α} => OptionT.orElse
@[inline]
Equations
- OptionT.lift x = OptionT.mk do let __do_lift ← x pure (some __do_lift)
Instances For
instance
OptionT.instMonadExceptOfUnitOptionT
{m : Type u → Type v}
[Monad m]
:
MonadExceptOf Unit (OptionT m)
Equations
- OptionT.instMonadExceptOfUnitOptionT = { throw := fun {α} x => OptionT.fail, tryCatch := fun {α} => OptionT.tryCatch }
instance
OptionT.instMonadExceptOfOptionT
{m : Type u → Type v}
(ε : Type u)
[Monad m]
[MonadExceptOf ε m]
:
MonadExceptOf ε (OptionT m)
Equations
- OptionT.instMonadExceptOfOptionT ε = { throw := fun {α} e => OptionT.mk (throwThe ε e), tryCatch := fun {α} x handle => OptionT.mk (tryCatchThe ε x handle) }
Equations
- instMonadControlOptionT = { stM := Option, liftWith := fun {α} f => liftM (f fun {β} x => OptionT.run x), restoreM := fun {α} x => x }