skip to main content
10.1145/1480881.1480889acmconferencesArticle/Chapter ViewAbstractPublication PagespoplConference Proceedingsconference-collections
research-article

Static contract checking for Haskell

Published:21 January 2009Publication History

ABSTRACT

Program errors are hard to detect and are costly both to programmers who spend significant efforts in debugging, and for systems that are guarded by runtime checks. Static verification techniques have been applied to imperative and object-oriented languages, like Java and C#, but few have been applied to a higher-order lazy functional language, like Haskell. In this paper, we describe a sound and automatic static verification framework for Haskell, that is based on contracts and symbolic execution. Our approach is modular and gives precise blame assignments at compile-time in the presence of higher-order functions and laziness.

References

  1. Lennart Augustsson. Cayenne -- language with dependent types. In Proceedings of the third ACM SIGPLAN international conference on Functional programming, pages 239--250, New York, NY, USA, 1998. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Mike Barnett, K. Rustan M. Leino, and Wolfram Schulte. The Spec# programming system: An overview. CASSIS, LNCS 3362, 2004.Google ScholarGoogle Scholar
  3. Matthias Blume and David McAllester. Sound and complete models of contracts. J. Funct. Program., 16(4-5):375--414, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. L. Burdy, Y. Cheon, D. Cok, M. Ernst, J. Kiniry, G. Leavens, K. Leino, and E. Poll. An overview of JML tools and applications, 2003.Google ScholarGoogle Scholar
  5. Koen Claessen and John Hughes. Specification-based testing with QuickCheck. In Fun of Programming, Cornerstones of Computing, pages 17--40. Palgrave, March 2003.Google ScholarGoogle Scholar
  6. Sa Cui, Kevin Donnelly, and Hongwei Xi. ATS: A language that combines programming with theorem proving. In Bernhard Gramlich, editor, FroCos, volume 3717 of Lecture Notes in Computer Science, pages 310--320. Springer, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Rowan Davies. Refinement-type checker for standard ML. In AMAST '97: Proceedings of the 6th International Conference on Algebraic Methodology and Software Technology, pages 565--566, London, UK, 1997. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Peter Dybjer, Qiao Haiyan, and Makoto Takeyama. Verifying Haskell programs by combining testing and proving. In Proceedings of Third International Conference on Quality Software, pages 272--279. IEEE Press, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. R. B. Findler, M. Blume, and M. Felleisen. An investigation of contracts as projections. Technical report, University of Chicago Computer Science Department, 2006. Technical Report TR-2004-02.Google ScholarGoogle Scholar
  10. Robert Bruce Findler and Matthias Blume. Contracts as pairs of projections. In Functional and Logic Programming, pages 226--241. Springer Berlin / Heidelberg, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Robert Bruce Findler and Matthias Felleisen. Contracts for higher-order functions. In Proceedings of the seventh ACM SIGPLAN international conference on Functional programming, pages 48--59, New York, NY, USA, 2002. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Cormac Flanagan. Hybrid type checking. In Morrisett and Peyton Jones \citeDBLP:conf/popl/2006, pages 245--256. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Cormac Flanagan, K. Rustan M. Leino, Mark Lillibridge, Greg Nelson, James B. Saxe, and Raymie Stata. Extended static checking for Java. In PLDI '02: Proceedings of the ACM SIGPLAN 2002 Conference on Programming language design and implementation, pages 234--245, New York, NY, USA, 2002. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Cormac Flanagan and James B. Saxe. Avoiding exponential explosion: generating compact verification conditions. In POPL '01: Proceedings of the 28th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 193--205, New York, NY, USA, 2001. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Tim Freeman and Frank Pfenning. Refinement types for ML. In PLDI '91: Proceedings of the ACM SIGPLAN 1991 conference on Programming language design and implementation, pages 268--277, New York, NY, USA, 1991. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Jessica Gronski and Cormac Flanagan. Unifying hybrid types and contracts. In Eighth Symposium on Trends in Functional Programming, April 2007.Google ScholarGoogle Scholar
  17. Thomas Hallgren. Haskell tools from the Programatica project. In Haskell '03: Proceedings of the 2003 ACM SIGPLAN workshop on Haskell, pages 103--106, New York, NY, USA, 2003. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Ralf Hinze, Johan Jeuring, and Andres Löh. Typed contracts for functional programming. In Functional and Logic Programming: 8th International Symposium, pages 208--225, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Kohei Honda and Nobuko Yoshida. A compositional logic for polymorphic higher-order functions. In PPDP '04: Proceedings of the 6th ACM SIGPLAN international conference on Principles and practice of declarative programming, pages 191--202, New York, NY, USA, 2004. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Kenneth Knowles and Cormac Flanagan. Type reconstruction for general refinement types. In ESOP '07: Programming Languages and Systems, 16th European Symposium on Programming. Springer-Verlag, April 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Kenneth Knowles, Aaron Tomb, Jessica Gronski, Stephen N. Freund, and Cormac Flanagan. SAGE: Unified hybrid checking for first--class types, general refinement types, and dynamic (extended report). Technical report, UC Santa Cruz, 2006. http://sage.soe.ucsc.edu/sage-tr.pdf.Google ScholarGoogle Scholar
  22. K. Rustan M. Leino and Greg Nelson. An extended static checker for Modula-3. In CC '98: Proceedings of the 7th International Conference on Compiler Construction, pages 302--305, London, UK, 1998. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Philippe Meunier, Robert Bruce Findler, and Matthias Felleisen. Modular set-based analysis from contracts. In Morrisett and Peyton Jones {27}, pages 218--231. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Bertrand Meyer. Eiffel: The Language. Prentice Hall International, London, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Neil Mitchell. Transformation and Analysis of Functional Programs. PhD thesis, University of York, 2008.Google ScholarGoogle Scholar
  26. Neil Mitchell and Colin Runciman. Not all patterns, but enough: an automatic verifier for partial but sufficient pattern matching. In Haskell '08: Proceedings of the first ACM SIGPLAN symposium on Haskell, pages 49--60, New York, NY, USA, 2008. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. J. Gregory Morrisett and Simon L. Peyton Jones, editors. POPL '06: Proceedings of the 33rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, Charleston, South Carolina, USA, January 11-13, 2006. ACM, 2006. Google ScholarGoogle ScholarCross RefCross Ref
  28. Aleksandar Nanevski, Amal Ahmed, Greg Morrisett, and Lars Birkedal. Abstract predicates and mutable ADTs in Hoare Type Theory. In Rocco De Nicola, editor, ESOP, volume 4421 of Lecture Notes in Computer Science, pages 189--204. Springer, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Aleksandar Nanevski, Greg Morrisett, and Lars Birkedal. Polymorphism and separation in hoare type theory. In Proceedings of the 11th ACM SIGPLAN International Conference on Functional Programming, Portland, Oregon, USA, Sept., pages 62--73, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. D. L. Parnas. A technique for software module specification with examples. Communications of the ACM, 15(5):330--336, May 1972. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. Yann Régis-Gianas and François Pottier. A Hoare logic for call-by-value functional programs. In P Audebaud and C Paulin-Mohring, editors, MPC, volume 5133 of Lecture Notes in Computer Science, pages 305--335. Springer, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. Tim Sheard. Languages of the future. In OOPSLA '04: Companion to the 19th annual ACM SIGPLAN conference on Object-oriented programming systems, languages, and applications, pages 116--119, New York, NY, USA, 2004. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. The GHC Team. The Glasgow Haskell Compiler user's guide. www.haskell.org/ghc/documentation.html, 1998.Google ScholarGoogle Scholar
  34. J Visser, J. N. Oliveira, Barbosa L. S., J. F. Ferreira, and A. Mendes. CAMILA revival: VDM meets Haskell. In Nico Plat and Peter Gorm Larsen, editors, Overture Workshop (co-located with FM'05), 2005.Google ScholarGoogle Scholar
  35. Philip Wadler and Robert Bruce Findler. Well-typed programs can't be blamed. In Workshop on Scheme and Functional Programming, Sept 2007.Google ScholarGoogle Scholar
  36. Edwin M. Westbrook, Aaron Stump, and Ian Wehrman. A language--based approach to functionally correct imperative programming. In Proceedings of the 10th ACM SIGPLAN International Conference on Functional Programming, Tallinn, Estonia, pages 268--279, Sept. 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. Hongwei Xi and Frank Pfenning. Dependent types in practical programming. In POPL '99: Proceedings of the 26th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, pages 214--227, New York, NY, USA, 1999. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. Dana N. Xu. Extended static checking for Haskell. In Haskell '06: Proceedings of the 2006 ACM SIGPLAN workshop on Haskell, pages 48--59, New York, NY, USA, 2006. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. Na Xu. Static Contract Checking for Haskell. PhD thesis, University of Cambridge, 2008. http://www.cl.cam.ac.uk/techreports/.Google ScholarGoogle Scholar

Index Terms

  1. Static contract checking for Haskell

    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
      POPL '09: Proceedings of the 36th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages
      January 2009
      464 pages
      ISBN:9781605583792
      DOI:10.1145/1480881
      • cover image ACM SIGPLAN Notices
        ACM SIGPLAN Notices  Volume 44, Issue 1
        POPL '09
        January 2009
        453 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/1594834
        Issue’s Table of Contents

      Copyright © 2009 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: 21 January 2009

      Permissions

      Request permissions about this article.

      Request Permissions

      Check for updates

      Qualifiers

      • research-article

      Acceptance Rates

      Overall Acceptance Rate824of4,130submissions,20%

      Upcoming Conference

      POPL '25

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader