Errors as Data Values

Tero Hasu and Magne Haveraaen
Bergen Language Design Laboratory
Department of Informatics
University of Bergen, Norway


A “thrown” exception is a non-local side effect that complicates static reasoning about code. Particularly in functional languages it is fairly common to instead propagate errors as ordinary values. The propagation is sometimes done in monadic style, and some languages include syntactic conveniences for writing expressions in that style. We discuss a guarded-algebra-inspired approach for integrating similar, implicit error propagation into a language with “normal” function application syntax. The presented failure management approach accommodates language designs with all-referentially-transparent expressions. It furthermore supports automatically checking data invariants and function pre- and post-conditions, recording a trace of any due-to-an-error unevaluateable or failed expressions, and in some cases retaining “bad” values for potential use in recovering from an error.


  author =       {Tero Hasu and Magne Haveraaen},
  title =        {Errors as Data Values},
  booktitle =    {Proceedings of the Norwegian Informatics Conference
                  (NIK 2016)},
  year =         2016,
  month =        nov,
  location =     {Bergen, Norway}


(define hasu-haveraaen-2016-errors
   #:title "Errors as Data Values"
   #:author (authors "Tero Hasu" "Magne Haveraaen")
   #:date "2016"
   #:location (proceedings-location
     "Norwegian Informatics Conference")))

Publication Details

as PDF
NIK 2016 (Norsk Informatikkonferanse 2016)
  • organized by Høgskolen i Bergen