A Pattern Logic for Prompt Lazy Assertions in Haskell

  • Olaf Chitil
  • Frank Huch
Part of the Lecture Notes in Computer Science book series (LNCS, volume 4449)

Abstract

Assertions test expected properties of run-time values without disrupting the normal computation of a program. Here we present a library for enriching programs in the lazy language Haskell with assertions. Expected properties are written in an expressive pattern logic that combines pattern matching with logical operations and predicates. The presented assertions are lazy: they do not force evaluation but only examine what is evaluated by other parts of the program. They are also prompt: assertion failure is reported as early as possible, before a faulty value is used by the main computation.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Broberg, N., Farre, A., Svenningsson, J.: Regular expression patterns. In: ICFP 2004: Proceedings of the ninth ACM SIGPLAN international conference on Functional programming, pp. 67–78. ACM Press, New York (2004)CrossRefGoogle Scholar
  2. 2.
    Chitil, O., McNeill, D., Runciman, C.: Lazy assertions. In: Trinder, P., Michaelson, G., Peña, R. (eds.) IFL 2003. LNCS, vol. 3145, pp. 1–19. Springer, Heidelberg (2004)Google Scholar
  3. 3.
    Claessen, K., Hughes, R.J.M.: QuickCheck: a lightweight tool for random testing of Haskell programs. In: Proc. 5th Intl. ACM Conference on Functional Programming, pp. 268–279. ACM Press, New York (2000)Google Scholar
  4. 4.
    Claessen, K., Runciman, C., Chitil, O., Hughes, J., Wallace, M.: Testing and Tracing Lazy Functional Programs using QuickCheck and Hat. In: Jeuring, J., Jones, S.L.P. (eds.) AFP 2002. LNCS, vol. 2638, pp. 59–99. Springer, Heidelberg (2003)Google Scholar
  5. 5.
    Findler, R.B., Felleisen, M.: Contracts for higher-order functions. In: ICFP 2002: Proceedings of the seventh ACM SIGPLAN international conference on Functional programming, pp. 48–59. ACM Press, New York (2002)CrossRefGoogle Scholar
  6. 6.
    Gill, A.: Debugging Haskell by observing intermediate datastructures. Electronic Notes in Theoretical Computer Science, In: Proc. 2000 ACM SIGPLAN Haskell Workshop. vol. 41(1) (2001)Google Scholar
  7. 7.
    Hinze, R., Jeuring, J., Löh, A.: Typed contracts for functional programming. In: Hagiya, M., Wadler, P. (eds.) FLOPS 2006. LNCS, vol. 3945, pp. 208–225. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  8. 8.
    Meyer, B.: Applying design by contract. Computer 25(10), 40–51 (1992)CrossRefGoogle Scholar
  9. 9.
    Meyer, B.: Eiffel: The Language. Prentice-Hall, Inc. Englewood Cliffs (1992)MATHGoogle Scholar
  10. 10.
    Mohnen, M.: Context patterns, part II. In: Clack, C., Hammond, K., Davie, T. (eds.) IFL 1997. LNCS, vol. 1467, pp. 338–357. Springer, Heidelberg (1998)CrossRefGoogle Scholar
  11. 11.
    Parnas, D.L.: A technique for software module specification with examples. Commun. ACM 15(5), 330–336 (1972)CrossRefGoogle Scholar
  12. 12.
    Jones, S.P., Gordon, A., Finne, S.: Concurrent Haskell. In: Conference Record of POPL 1996: The 23rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 295–308, (January 21–24, 1996)Google Scholar
  13. 13.
    Rosenblum, D.S.: A practical approach to programming with assertions. IEEE Trans. Softw. Eng. 21(1), 19–31 (1995)CrossRefGoogle Scholar
  14. 14.
    Sheard, T., Jones, S.P.: Template metaprogramming for haskell. In: Haskell Workshop 2002 (October 2002)Google Scholar
  15. 15.
    Swierstra, Alcocer,: Fast, error correcting parser combinators: A short tutorial. In: Bartosek, M., Tel, G., Pavelka, J. (eds.) SOFSEM 1999. LNCS, vol. 1725, Springer, Heidelberg (1999)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2007

Authors and Affiliations

  • Olaf Chitil
    • 1
  • Frank Huch
    • 2
  1. 1.University of KentUK
  2. 2.CAU KielGermany

Personalised recommendations