The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V01. The language of Mathlib

Mathlib.Lean.Exception

2 declarations. Mathlib docs · Source

Additional methods for working with Exceptions

This file contains two additional methods for working with Exceptions

  • successIfFail, a generalisation of fail_if_success to arbitrary MonadErrors
  • isFailedToSynthesize: check if an exception is of the "failed to synthesize" form

def successIfFail E1 #

{α : Type} → {M : Type → Type} → [Lean.MonadError M] → [Monad M] → M α → M Lean.Exception

A generalisation of fail_if_success to an arbitrary MonadError.

def Lean.Exception.isFailedToSynthesize E1 #

Lean.Exception → IO Bool

Check if an exception is a "failed to synthesize" exception.

These exceptions are raised in several different places, and the only commonality is the prefix of the string, so that's what we look for.