summaryrefslogtreecommitdiff
path: root/Common
diff options
context:
space:
mode:
Diffstat (limited to 'Common')
-rw-r--r--Common/Option.lean4
1 files changed, 4 insertions, 0 deletions
diff --git a/Common/Option.lean b/Common/Option.lean
index 23ea8d6..275f83f 100644
--- a/Common/Option.lean
+++ b/Common/Option.lean
@@ -5,3 +5,7 @@ def zip (a : Option α) (b : Option β) : Option (α×β) := a >>= λ a ↦ b >>
def unzip : (a : Option (α×β)) → (Option α) × (Option β)
| none => (none, none)
| some (a, b) => (some a, some b)
+
+def toExcept {α : Type u0} {ε : Type u1} { m : Type u0 → Type u2} [Pure m] [MonadExcept m (ε := ε)] (error : ε) : Option α → m α
+| none => throw error
+| some a => pure a