Advertisement

Laws of Monadic Error Handling

  • Härmel NestraEmail author
Conference paper
  • 152 Downloads
Part of the Lecture Notes in Computer Science book series (LNCS, volume 11884)

Abstract

One of the numerous applications of monads in functional programming is error handling. This paper proposes several new axiomatics for equational reasoning about monadic computations with error handling and studies their relationships with each other and with axiomatics considered earlier. The primary intended application area is deterministic top-down parsing.

Keywords

Monads Error handling Parsing Equational reasoning 

Notes

Acknowledgement

This work was partially supported by the Estonian Research Council grant PSG61. The author thanks all anonymous reviewers for their valuable feedback.

References

  1. 1.
    Ahman, D., Uustalu, T.: Update monads: cointerpreting directed containers. In: Matthes, R., Schubert, A. (eds.) 19th International Conference on Types for Proofs and Programs, TYPES 2013, Toulouse, France, 22–26 April 2013. LIPIcs, vol. 26, pp. 1–23. Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik (2013).  https://doi.org/10.4230/LIPIcs.TYPES.2013.1
  2. 2.
    Altenkirch, T., Chapman, J., Uustalu, T.: Monads need not be endofunctors. In: Ong, L. (ed.) FoSSaCS 2010. LNCS, vol. 6014, pp. 297–311. Springer, Heidelberg (2010).  https://doi.org/10.1007/978-3-642-12032-9_21CrossRefGoogle Scholar
  3. 3.
    Altenkirch, T., Chapman, J., Uustalu, T.: Monads need not be endofunctors. Log. Methods Comput. Sci. 11(1) (2015).  https://doi.org/10.2168/LMCS-11(1:3)2015
  4. 4.
    Danielsson, N.A., Hughes, J., Jansson, P., Gibbons, J.: Fast and loose reasoning is morally correct. In: Morrisett, J.G., Jones, S.L.P. (eds.) Proceedings of the 33rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2006, Charleston, South Carolina, USA, 11–13 January 2006, pp. 206–217. ACM (2006).  https://doi.org/10.1145/1111037.1111056
  5. 5.
    Ford, B.: Parsing expression grammars: a recognition-based syntactic foundation. In: Jones, N.D., Leroy, X. (eds.) Proceedings of the 31st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2004, Venice, Italy, 14–16 January 2004, pp. 111–122. ACM (2004).  https://doi.org/10.1145/964001.964011
  6. 6.
    Gibbons, J., Hinze, R.: Just do it: simple monadic equational reasoning. In: Chakravarty, M.M.T., Hu, Z., Danvy, O. (eds.) Proceeding of the 16th ACM SIGPLAN International Conference on Functional Programming, ICFP 2011, Tokyo, Japan, 19–21 September 2011, pp. 2–14. ACM (2011).  https://doi.org/10.1145/2034773.2034777
  7. 7.
  8. 8.
  9. 9.
    Hutton, G., Meijer, E.: Monadic parser combinators. Technical report NOTTCS-TR-96-4, University of Nottingham (1996)Google Scholar
  10. 10.
    Hutton, G., Meijer, E.: Monadic parsing in Haskell. J. Funct. Program. 8(4), 437–444 (1998).  https://doi.org/10.1017/S0956796898003050CrossRefzbMATHGoogle Scholar
  11. 11.
    Liang, S., Hudak, P., Jones, M.P.: Monad transformers and modular interpreters. In: Cytron, R.K., Lee, P. (eds.) Conference Record of POPL 1995: 22nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, San Francisco, California, USA, 23–25 January 1995, pp. 333–343. ACM Press (1995).  https://doi.org/10.1145/199448.199528
  12. 12.
    The Libraries archives. Proposal: Laws for MTL classes. https://mail.haskell.org/pipermail/libraries/2019-April/029549.html
  13. 13.
    Malakhovski, J.: Exceptionally monadic error handling. CoRR abs/1810.13430 (2018). http://arxiv.org/abs/1810.13430
  14. 14.
    Moggi, E.: An abstract view of programming languages. Technical report ECS-LFCS-90-113, University of Edinburgh (1990)Google Scholar
  15. 15.
    Nestra, H.: Double applicative functors. In: Fischer, B., Uustalu, T. (eds.) ICTAC 2018. LNCS, vol. 11187, pp. 333–353. Springer, Cham (2018).  https://doi.org/10.1007/978-3-030-02508-3_18CrossRefGoogle Scholar
  16. 16.
    Wadler, P.: Comprehending monads. In: LISP and Functional Programming, pp. 61–78 (1990).  https://doi.org/10.1145/91556.91592
  17. 17.
    Wadler, P.: The essence of functional programming. In: Sethi, R. (ed.) Conference Record of the Nineteenth Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, Albuquerque, New Mexico, USA, 19–22 January 1992, pp. 1–14. ACM Press (1992).  https://doi.org/10.1145/143165.143169

Copyright information

© Springer Nature Switzerland AG 2019

Authors and Affiliations

  1. 1.Institute of Computer ScienceUniversity of TartuTartuEstonia

Personalised recommendations