Abstract
A datatype-generic function is a family of functions indexed by (the structure of) a type. Examples include equality tests, maps and pretty printers. Property based testing tools like QuickCheck and Gast support the definition of properties and test-data generators, and they check if a monomorphic property is satisfied by the test cases. Generic functions satisfy generic properties and this paper discusses specifying and testing such properties. It shows how generic properties and generators can be expressed, and explains three bugs we found and corrected in the Generic Haskell library.
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
Beck, K.: Test-Driven Development by Example. Addison-Wesley, Reading (2003)
Claessen, K., Hughes, J.: QuickCheck: A lightweight tool for random testing of Haskell programs. In: ICFP 2000, pp. 268–279. ACM Press, New York (2000)
Hinze, R.: Generic Programs and Proofs. Bonn University, Habilitation (2000)
Hinze, R., Jeuring, J.: Generic Haskell: practice and theory. In: Backhouse, R., Gibbons, J. (eds.) Generic Programming. LNCS, vol. 2793, pp. 1–56. Springer, Heidelberg (2003)
Hinze, R., Jeuring, J., Löh, A.: Comparing approaches to generic programming in Haskell. Technical Report UU-CS-2006-022, ICS, Utrecht University, 2006. In: Datatype-Generic Programming, LNCS, Springer (to appear, 2007)
Holdermans, S., Jeuring, J., Löh, A., Rodriguez, A.: Generic views on data types. In: Uustalu, T. (ed.) MPC 2006. LNCS, vol. 4014, Springer, Heidelberg (2006)
Jansson, P., Jeuring, J.: PolyLib – a polytypic function library. In: Workshop on Generic Programming, Marstrand (June 1998)
Koopman, P., Alimarine, A., Tretmans, J., Plasmeijer, R.: Gast: Generic automated software testing. In: Arts, T., Mohnen, M. (eds.) IFL 2002. LNCS, vol. 2312, pp. 84–100. Springer, Heidelberg (2002)
Koopman, P., Plasmeijer, R.: Generic generation of elements of types. In: TFP’05, pp. 167–179. Tallinn (2005)
Löh, A.: Exploring Generic Haskell. PhD thesis, Utrecht University (2004)
Löh, A., Clarke, D., Jeuring, J.: Dependency-style Generic Haskell. In: Shivers, O. (ed.) ICFP 2003, pp. 141–152. ACM Press, New York (2003)
Löh, A., Jeuring, J., Rodriguez, A.: (editors) et al. The Generic Haskell user’s guide, Version 1.60 - Diamond release. Technical Report UU-CS-2006-049, ICS, Utrecht University (2006)
Mitchelland, R., McKim, J.: Design by Contract: by example. Addison-Wesley, Reading (2002)
Peyton Jones, S., et al.: Haskell 98, Language and Libraries. In: The Revised Report, Cambridge University Press, Cambridge (2003)
Plasmeijer, R., van Eekelen, M.: Clean Language Report version 2.1 (2005)
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 2007 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Jansson, P. et al. (2007). Testing Properties of Generic Functions. 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_13
Download citation
DOI: https://doi.org/10.1007/978-3-540-74130-5_13
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)