DeepAI AI Chat
Log In Sign Up

Exceptionally Monadic Error Handling

10/31/2018
by   Jan Malakhovski, et al.
0

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.

READ FULL TEXT

page 1

page 2

page 3

page 4

01/24/2023

Bridging Swift Error Handling Model to C++

Error handling is the process of responding to and recovering from error...
03/07/2023

Marpa and nullable symbols

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

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...
01/27/2022

Efficient Quantum Computation of the Fermionic Boundary Operator

The boundary operator is a linear operator that acts on a collection of ...
05/25/2023

Implementing backjumping by means of exception handling

We discuss how to implement backjumping (or intelligent backtracking) in...
11/02/2022

Interpretable Modeling and Reduction of Unknown Errors in Mechanistic Operators

Prior knowledge about the imaging physics provides a mechanistic forward...
04/23/2018

Measurement Errors in R

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