leanprover-community / mathlib

  • Home
  • Zulip archive
  • API documentation
  • Lean web editor
  • Links

Zulip Chat Archive

Stream: lean4

Topic: Unwrap Except


Cole Shepherd (Dec 03 2022 at 20:46):

How do you unwrap an Except, and panic if it's an error?

Henrik Böving (Dec 03 2022 at 20:53):

You can pattern match on it I guess? Like so:

  let .ok val := x | panic! "Ahhhh"
  val

Henrik Böving (Dec 03 2022 at 20:53):

But there is no built in unwrap() style function right now


Last updated: May 02 2025 at 03:31 UTC

Theme Simple by wildflame © 2016 Powered by jekyll