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.
- 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 ScholarCross Ref
- 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 Scholar
- F. Barbanera, M. Dezaniciancaglini, and U. Deliguoro. Intersection and union types: Syntax and semantics. Information and Computation, 119(2):202–230, 1995. Google ScholarDigital Library
- J. Cheney and R. Hinze. First-class phantom types. Technical report, Cornell University, 2003.Google Scholar
- B. Emir, M. Odersky, and J. Williams. Matching objects with patterns. In European Conference on Object-Oriented Programming, pages 273–298. Springer, 2007. Google ScholarDigital Library
- J. Garrigue and J. Normand. Adding GADTs to ocaml: The direct approach. In Workshop on ML, 2011.Google Scholar
- 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 Scholar
- L. Maranget. Warnings for pattern matching. Journal of Functional Programming, 17(03):387–421, 2007.Google ScholarCross Ref
- M. Odersky and M. Zenger. Scalable component abstractions. In ACM Sigplan Notices, volume 40, pages 41–57. ACM, 2005. Google ScholarDigital Library
- R. Sekar, R. Ramesh, and I. Ramakrishnan. Adaptive pattern matching. In International Colloquium on Automata, Languages, and Programming, pages 247–260. Springer, 1992. Google ScholarDigital Library
- H. Xi. Dependently typed pattern matching. Journal of universal computer science, 9(8):851–872, 2003.Google Scholar
- H. Xi, C. Chen, and G. Chen. Guarded recursive datatype constructors. In ACM SIGPLAN Notices, volume 38, pages 224–235. ACM, 2003. Google ScholarDigital Library
- Introduction Algorithm Idea Design Algorithm Discussion Evaluation Correctness Maintainability Performance Limitations Related Work ConclusionGoogle Scholar
Index Terms
- A generic algorithm for checking exhaustivity of pattern matching (short paper)
Recommendations
Towards algorithmic typing for DOT (short paper)
SCALA 2017: Proceedings of the 8th ACM SIGPLAN International Symposium on ScalaThe Dependent Object Types (DOT) calculus formalizes key features of Scala. The D<: calculus is the core of DOT. To date, presentations of D<: have used declarative, as opposed to algorithmic, typing and subtyping rules. Unfortunately, algorithmic ...
Typed self-interpretation by pattern matching
ICFP '11: Proceedings of the 16th ACM SIGPLAN international conference on Functional programmingSelf-interpreters can be roughly divided into two sorts: self-recognisers that recover the input program from a canonical representation, and self-enactors that execute the input program. Major progress for statically-typed languages was achieved in ...
Typed self-interpretation by pattern matching
ICFP '11Self-interpreters can be roughly divided into two sorts: self-recognisers that recover the input program from a canonical representation, and self-enactors that execute the input program. Major progress for statically-typed languages was achieved in ...
Comments