skip to main content
10.1145/2998392.2998401acmconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
short-paper

A generic algorithm for checking exhaustivity of pattern matching (short paper)

Published:30 October 2016Publication History

ABSTRACT

Algebraic data types and pattern matching are key features of func- tional programming languages. Exhaustivity checking of pattern matching is a safety belt that defends against unmatched excep- tions at runtime and boosts type safety. However, the presence of language features like inheritance, typecase, traits, GADTs, path- dependent types and union types makes the checking difficult and the algorithm complex.

In this paper we propose a generic algorithm that decouples the checking algorithm from specific type theories. The decoupling makes the algorithm simple and enables easy customization for specific type systems.

References

  1. M. Abadi, L. Cardelli, B. C. Pierce, D. Rémy, and R. Taylor. Dynamic typing in polymorphic languages. Journal of functional programming, 5(1):111–130, 1995.Google ScholarGoogle ScholarCross RefCross Ref
  2. N. Amin, S. Grütter, M. Odersky, T. Rompf, and S. Stucki. The essence of dependent object types. In A List of Successes That Can Change the World, pages 249–272. Springer, 2016.Google ScholarGoogle Scholar
  3. F. Barbanera, M. Dezaniciancaglini, and U. Deliguoro. Intersection and union types: Syntax and semantics. Information and Computation, 119(2):202–230, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. J. Cheney and R. Hinze. First-class phantom types. Technical report, Cornell University, 2003.Google ScholarGoogle Scholar
  5. B. Emir, M. Odersky, and J. Williams. Matching objects with patterns. In European Conference on Object-Oriented Programming, pages 273–298. Springer, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. J. Garrigue and J. Normand. Adding GADTs to ocaml: The direct approach. In Workshop on ML, 2011.Google ScholarGoogle Scholar
  7. G. Karachalias, T. Schrijvers, D. Vytiniotis, and S. P. Jones. GADTs meet their match. In International Conference on Functional Programming, ICFP, volume 15, 2015.Google ScholarGoogle Scholar
  8. L. Maranget. Warnings for pattern matching. Journal of Functional Programming, 17(03):387–421, 2007.Google ScholarGoogle ScholarCross RefCross Ref
  9. M. Odersky and M. Zenger. Scalable component abstractions. In ACM Sigplan Notices, volume 40, pages 41–57. ACM, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. R. Sekar, R. Ramesh, and I. Ramakrishnan. Adaptive pattern matching. In International Colloquium on Automata, Languages, and Programming, pages 247–260. Springer, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. H. Xi. Dependently typed pattern matching. Journal of universal computer science, 9(8):851–872, 2003.Google ScholarGoogle Scholar
  12. H. Xi, C. Chen, and G. Chen. Guarded recursive datatype constructors. In ACM SIGPLAN Notices, volume 38, pages 224–235. ACM, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Introduction Algorithm Idea Design Algorithm Discussion Evaluation Correctness Maintainability Performance Limitations Related Work ConclusionGoogle ScholarGoogle Scholar

Index Terms

  1. A generic algorithm for checking exhaustivity of pattern matching (short paper)

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in
    • Published in

      cover image ACM Conferences
      SCALA 2016: Proceedings of the 2016 7th ACM SIGPLAN Symposium on Scala
      October 2016
      113 pages
      ISBN:9781450346481
      DOI:10.1145/2998392

      Copyright © 2016 ACM

      Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 30 October 2016

      Permissions

      Request permissions about this article.

      Request Permissions

      Check for updates

      Qualifiers

      • short-paper

      Upcoming Conference

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader