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.
This work has been partially supported by the German Research Council (DFG) under grant Ha 2457/5-2 and by the United Kingdom under EPSRC grant EP/C516605/1.
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
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)
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)
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)
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)
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)
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)
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)
Meyer, B.: Applying design by contract. Computer 25(10), 40–51 (1992)
Meyer, B.: Eiffel: The Language. Prentice-Hall, Inc. Englewood Cliffs (1992)
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)
Parnas, D.L.: A technique for software module specification with examples. Commun. ACM 15(5), 330–336 (1972)
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)
Rosenblum, D.S.: A practical approach to programming with assertions. IEEE Trans. Softw. Eng. 21(1), 19–31 (1995)
Sheard, T., Jones, S.P.: Template metaprogramming for haskell. In: Haskell Workshop 2002 (October 2002)
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)
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 2007 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Chitil, O., Huch, F. (2007). A Pattern Logic for Prompt Lazy Assertions in Haskell. In: Horváth, Z., Zsók, V., Butterfield, A. (eds) Implementation and Application of Functional Languages. IFL 2006. Lecture Notes in Computer Science, vol 4449. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-74130-5_8
Download citation
DOI: https://doi.org/10.1007/978-3-540-74130-5_8
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-74129-9
Online ISBN: 978-3-540-74130-5
eBook Packages: Computer ScienceComputer Science (R0)