DeepAI AI Chat
Log In Sign Up

Exceptionally Monadic Error Handling

by   Jan Malakhovski, et al.

We notice that the type of src_haskellcatch :: c a -> (e -> c a) -> c a operator is a special case of monadic src_haskellbind operator src_haskell(>>=) :: m a -> (a -> m b) -> m b and the semantic (surprisingly) matches. For instance, the reader is probably aware that the monadic essence of the src_haskell(>>=) operator of the error monad λ A.E A is to behave like identity monad for "normal" values and to stop on "errors". The unappreciated fact is that handling of said "errors" with a src_haskellcatch operator of the "flipped" "conjoined" error monad λ E.E A is, too, a monadic computation that treats still unhandled "errors" as "normal" values and stops when an "error" is finally handled. This fact has several immediate practical consequences for monadic parser combinators and similar structures. More importantly, however, it can be generalized to provide a uniform error handling framework for /all/ monadic error handling mechanisms we are aware of. It also provides some surprising perspectives on error handling in general.


page 1

page 2

page 3

page 4


Bridging Swift Error Handling Model to C++

Error handling is the process of responding to and recovering from error...

Marpa and nullable symbols

The Marpa parser was intended to make the best results in the academic l...

Gauss and the identity function – a tale of characterizations of the normal distribution

The normal distribution is well-known for several results that it is the...

Efficient Quantum Computation of the Fermionic Boundary Operator

The boundary operator is a linear operator that acts on a collection of ...

Implementing backjumping by means of exception handling

We discuss how to implement backjumping (or intelligent backtracking) in...

Interpretable Modeling and Reduction of Unknown Errors in Mechanistic Operators

Prior knowledge about the imaging physics provides a mechanistic forward...

Measurement Errors in R

This paper presents an R package to handle and represent measurements wi...