skip to main content
research-article

Shrinking and showing functions: (functional pearl)

Published:13 September 2012Publication History
Skip Abstract Section

Abstract

Although quantification over functions in QuickCheck properties has been supported from the beginning, displaying and shrinking them as counter examples has not. The reason is that in general, functions are infinite objects, which means that there is no sensible show function for them, and shrinking an infinite object within a finite number of steps seems impossible. This paper presents a general technique with which functions as counter examples can be shrunk to finite objects, which can then be displayed to the user. The approach turns out to be practically usable, which is shown by a number of examples. The two main limitations are that higher-order functions cannot be dealt with, and it is hard to deal with terms that contain functions as subterms.

References

  1. J. Bernardy, P. Jansson, and K. Claessen. Testing polymorphic properties. In Proc. of European Symposium on Programming (ESOP). Springer LNCS, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. K. Claessen and J. Hughes. QuickCheck: A lightweight tool for random testing of Haskell programs. In Proc. of International Conference on Functional Programming (ICFP). ACM SIGPLAN, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. C. Elliott. Functional implementations of continuous modeled animation. In Proc. of PLILP/ALP. Springer LNCS, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. M. Escardo. Infinite sets that admit fast exhaustive search. In Proc. of Logic in Computer Science (LICS). IEEE, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. R. Hinze. Generalizing generalized tries. J. Funct. Program., 10(4): 327--351, July 2000. ISSN 0956-7968. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. C. Runciman, M. Naylor, and F. Lindblad. SmallCheck and Lazy SmallCheck - automatic exhaustive testing for small values. In Proc. of Haskell Symposium. ACM SIGPLAN, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Shrinking and showing functions: (functional pearl)

    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

    Full Access

    • Published in

      cover image ACM SIGPLAN Notices
      ACM SIGPLAN Notices  Volume 47, Issue 12
      Haskell '12
      December 2012
      157 pages
      ISSN:0362-1340
      EISSN:1558-1160
      DOI:10.1145/2430532
      Issue’s Table of Contents
      • cover image ACM Conferences
        Haskell '12: Proceedings of the 2012 Haskell Symposium
        September 2012
        168 pages
        ISBN:9781450315746
        DOI:10.1145/2364506

      Copyright © 2012 ACM

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 13 September 2012

      Check for updates

      Qualifiers

      • research-article

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader
    About Cookies On This Site

    We use cookies to ensure that we give you the best experience on our website.

    Learn more

    Got it!