Abstract
For ML and Haskell, accurate warnings when a function definition has redundant or missing patterns are mission critical. But today's compilers generate bogus warnings when the programmer uses guards (even simple ones), GADTs, pattern guards, or view patterns. We give the first algorithm that handles all these cases in a single, uniform framework, together with an implementation in GHC, and evidence of its utility in practice.
- L. Augustsson. Compiling pattern matching. In Proceedings of the 1985 Conference on Functional Programming and Computer Architecture, 1985. Google Scholar
Digital Library
- E. Brady. Programming and reasoning with algebraic effects and dependent types. In Proceedings of the 18th ACM SIGPLAN International Conference on Functional Programming, ICFP ’13, pages 133– 144, New York, NY, USA, 2013. ACM.. Google Scholar
Digital Library
- E. Brady. Idris, a general-purpose dependently typed programming language: Design and implementation. Journal of Functional Programming, 23:552–593, 9 2013..Google Scholar
Cross Ref
- J. Cheney and R. Hinze. First-class phantom types. Technical report, Cornell University, 2003.Google Scholar
- K. Claessen, M. Johansson, D. Rosén, and N. Smallbone. Automating inductive proofs using theory exploration. In M. P. Bonacina, editor, CADE, volume 7898 of Lecture Notes in Computer Science, pages 392–406. Springer, 2013. Google Scholar
Digital Library
- T. Coquand. Pattern matching with dependent types. In Proceedings of the Workshop on Types for Proofs and Programs, 1992.Google Scholar
- J. Dunfield. A Unified System of Type Refinements. PhD thesis, Carnegie Mellon University, Aug. 2007. CMU-CS-07-129.Google Scholar
- J. Dunfield. Refined typechecking with Stardust. In Proceedings of the 2007 Workshop on Programming Languages Meets Program Verification, PLPV ’07, pages 21–32, New York, NY, USA, 2007. Google Scholar
Digital Library
- ACM..Google Scholar
- M. Erwig and S. Peyton Jones. Pattern guards and transformational patterns. In Proceedings of the 2000 Haskell Symposium. ACM, 2000.Google Scholar
- J. Garrigue and J. L. 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 (extended version). Technical report, KU Leuven, 2015. URL http://people.cs.kuleuven.be/~george. karachalias/papers/gadtpm_ext.pdf.Google Scholar
- N. R. Krishnaswami. Focusing on pattern matching. In Proceedings of the 36th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL ’09, pages 366–378, New York, NY, USA, 2009. ACM.. Google Scholar
Digital Library
- A. Laville. Comparison of priority rules in pattern matching and term rewriting. J. Symb. Comput., 11(4):321–347, May 1991.. Google Scholar
Digital Library
- F. Le Fessant and L. Maranget. Optimizing pattern-matching. In Proceedings of the 2001 International Conference on Functional Programming, 2001. Google Scholar
Digital Library
- L. Maranget. Compiling lazy pattern matching. In Proceedings of the 1992 ACM Conference on LISP and Functional Programming, LFP ’92, pages 21–31, New York, NY, USA, 1992. ACM.. Google Scholar
Digital Library
- L. Maranget. Warnings for pattern matching. Journal of Functional Programming, 17:387–421, 2007.Google Scholar
Cross Ref
- L. Maranget. Compiling pattern matching to good decision trees. In Proceedings of the ACM Workshop on ML, 2008. Google Scholar
Digital Library
- L. Maranget and P. Para. Two techniques for compiling lazy pattern matching. Technical report, 1994.Google Scholar
- The Coq development team. The Coq proof assistant reference manual. LogiCal Project, 2004. URL http://coq.inria.fr. Version 8.0.Google Scholar
- C. McBride and J. McKinna. The view from the left. Journal of Functional Programming, 14(1):69–111, 2004. Google Scholar
Digital Library
- N. Mitchell and C. Runciman. Not all patterns, but enough: An automatic verifier for partial but sufficient pattern matching. In Proceedings of the First ACM SIGPLAN Symposium on Haskell, Haskell ’08, pages 49–60, New York, NY, USA, 2008. ACM.. Google Scholar
Digital Library
- U. Norell. Towards a practical programming language based on dependent type theory. PhD thesis, Department of Computer Science and Engineering, Chalmers University of Technology, SE-412 96 Göteborg, Sweden, September 2007.Google Scholar
- S. Peyton Jones, D. Vytiniotis, S. Weirich, and G. Washburn. Simple unification-based type inference for GADTs. In Proceedings of the Eleventh ACM SIGPLAN International Conference on Functional Programming, ICFP ’06, pages 50–61, New York, NY, USA, 2006. Google Scholar
Digital Library
- ACM..Google Scholar
- P. M. Rondon, M. Kawaguci, and R. Jhala. Liquid types. In Proceedings of the 2008 ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI ’08, pages 159–169, New York, NY, USA, 2008. ACM.. Google Scholar
Digital Library
- T. Schrijvers, S. Peyton Jones, M. Sulzmann, and D. Vytiniotis. Complete and decidable type inference for GADTs. In Proceedings of the 14th ACM SIGPLAN International Conference on Functional Programming, ICFP ’09, pages 341–352, New York, NY, USA, 2009. Google Scholar
Digital Library
- ACM..Google Scholar
- R. C. Sekar, R. Ramesh, and I. V. Ramakrishnan. Adaptive pattern matching. SIAM J. Comput., 24(6):1207–1234, Dec. 1995. ISSN 0097-5397.. Google Scholar
Digital Library
- P. Sestoft. ML pattern match compilation and partial evaluation. In O. Danvy, R. Glück, and P. Thiemann, editors, Partial Evaluation, volume 1110 of Lecture Notes in Computer Science, pages 446–464. Springer Berlin Heidelberg, 1996.. Google Scholar
Digital Library
- T. Sheard. Languages of the future. In In OOPSLA ’04: Companion to the 19th annual ACM SIGPLAN conference on Object-oriented programming systems, languages, and applications, pages 116–119. ACM Press, 2004. Google Scholar
Digital Library
- W. Sonnex, S. Drossopoulou, and S. Eisenbach. Zeno: An automated prover for properties of recursive data structures. pages 407–421. Springer-Verlag Berlin, 2012.. Google Scholar
Digital Library
- P. Thiemann. Avoiding repeated tests in pattern matching. In G. Filé, editor, 3rd International Workshop on Static Analysis, number 724, pages 141–152, Padova, Italia, Sept. 1993. Google Scholar
Digital Library
- N. Vazou, E. L. Seidel, R. Jhala, D. Vytiniotis, and S. Peyton-Jones. Refinement types for Haskell. In Proceedings of the 19th ACM SIGPLAN International Conference on Functional Programming, ICFP ’14, pages 269–282, New York, NY, USA, 2014. ACM.. Google Scholar
Digital Library
- P. Wadler. Views: A way for pattern matching to cohabit with data abstraction. In Proceedings of the 14th ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages, POPL ’87, pages 307–313, New York, NY, USA, 1987. ACM.. Google Scholar
Digital Library
- P. Wadler. Efficient compilation of pattern matching. In S. Peyton Jones, editor, The implementation of functional programming languages, pages 78–103. Prentice Hall, 1987.Google Scholar
- H. Xi. Dead code elimination through dependent types. In Proceedings of the First International Workshop on Practical Aspects of Declarative Languages, PADL ’99, pages 228–242, London, UK, 1998. Springer-Verlag. Google Scholar
Digital Library
- H. Xi. Dependent Types in Practical Programming. PhD thesis, Carnegie Mellon University, Sept. 1998. Google Scholar
Digital Library
- H. Xi. Dependently typed pattern matching. Journal of Universal Computer Science, 9:851–872, 2003.Google Scholar
- H. Xi, C. Chen, and G. Chen. Guarded recursive datatype constructors. In Proceedings of the 30th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL ’03, pages 224–235, New York, NY, USA, 2003. ACM.. Google Scholar
Digital Library
- D. N. Xu. Extended static checking for Haskell. In Proceedings of the 2006 ACM SIGPLAN Workshop on Haskell, Haskell ’06, pages 48–59, New York, NY, USA, 2006. ACM.. Google Scholar
Digital Library
- D. N. Xu, S. Peyton Jones, and K. Claessen. Static contract checking for Haskell. In Proceedings of the 36th Annual ACM SIGPLANSIGACT Symposium on Principles of Programming Languages, POPL ’09, pages 41–52, New York, NY, USA, 2009. ACM.. Google Scholar
Digital Library
- B. A. Yorgey, S. Weirich, J. Cretin, S. Peyton Jones, D. Vytiniotis, and J. P. Magalhães. Giving Haskell a promotion. In Proceedings of the 8th ACM SIGPLAN Workshop on Types in Language Design and Implementation, TLDI ’12, pages 53–66, New York, NY, USA, 2012. Google Scholar
Digital Library
Index Terms
GADTs meet their match: pattern-matching warnings that account for GADTs, guards, and laziness
Recommendations
GADTs meet their match: pattern-matching warnings that account for GADTs, guards, and laziness
ICFP 2015: Proceedings of the 20th ACM SIGPLAN International Conference on Functional ProgrammingFor ML and Haskell, accurate warnings when a function definition has redundant or missing patterns are mission critical. But today's compilers generate bogus warnings when the programmer uses guards (even simple ones), GADTs, pattern guards, or view ...
Simple unification-based type inference for GADTs
Proceedings of the 2006 ICFP conferenceGeneralized algebraic data types (GADTs), sometimes known as "guarded recursive data types" or "first-class phantom types", are a simple but powerful generalization of the data types of Haskell and ML. Recent works have given compelling examples of the ...
Simple unification-based type inference for GADTs
ICFP '06: Proceedings of the eleventh ACM SIGPLAN international conference on Functional programmingGeneralized algebraic data types (GADTs), sometimes known as "guarded recursive data types" or "first-class phantom types", are a simple but powerful generalization of the data types of Haskell and ML. Recent works have given compelling examples of the ...






Comments