Enumerating Well-Typed Terms Generically

  • Alexey Rodriguez Yakushev
  • Johan Jeuring
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 5812)


We use generic programming techniques to generate well-typed lambda terms. We encode well-typed terms by means of generalized algebraic datatypes (GADTs) and existential types. The Spine approach to generic programming supports GADTs, but it does not support the definition of generic producers for existentials. We describe how to extend the Spine approach to support existentials and we use the improved Spine to define a generic enumeration function. We show that the enumeration function can be used to generate the terms of simply typed lambda calculus.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Augustsson, L.: Announcing Djinn, version 2004-12-11, a coding wizard (2005),
  2. 2.
    Benke, M., Dybjer, P., Jansson, P.: Universes for generic programs and proofs in dependent type theory. Nordic Journal of Computing 10(4), 265–289 (2003)zbMATHMathSciNetGoogle Scholar
  3. 3.
    Cheney, J., Hinze, R.: First-class phantom types. Technical report, Cornell University (2003)Google Scholar
  4. 4.
    Claessen, K., Hughes, J.: QuickCheck: A Lightweight Tool for Random Testing of Haskell Programs. In: ICFP 2000, pp. 286–279 (2000)Google Scholar
  5. 5.
    Dyckhoff, R.: Contraction-free sequent calculi for intuitionistic logic. The Journal of Symbolic Logic 57(3), 795–807 (1992)zbMATHCrossRefMathSciNetGoogle Scholar
  6. 6.
    Hinze, R., Löh, A.: “Scrap Your Boilerplate” revolutions. In: Uustalu, T. (ed.) MPC 2006. LNCS, vol. 4014, pp. 180–208. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  7. 7.
    Hinze, R., Löh, A., Oliveira, B.C.d.S.: “Scrap your boilerplate” reloaded. In: Hagiya, M., Wadler, P. (eds.) FLOPS 2006. LNCS, vol. 3945, pp. 13–29. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  8. 8.
    Katayama, S.: Systematic search for lambda expressions. In: TFP 2005 (2005)Google Scholar
  9. 9.
    Koopman, P., Alimarine, A., Tretmans, J., Plasmeijer, R.: Gast: Generic automated software testing. In: Peña, R., Arts, T. (eds.) IFL 2002. LNCS, vol. 2670. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  10. 10.
    Koopman, P., Plasmeijer, R.: Systematic synthesis of λ-terms. In: Essays dedicated to Henk Barendregt on the Occasion of his 60th Birthday (2007)Google Scholar
  11. 11.
    Lämmel, R., Jones, S.P.: Scrap your boilerplate: A practical design pattern for generic programming. In: TLDI 2003, pp. 26–37 (2003)Google Scholar
  12. 12.
    Morris, P.: Constructing Universes for Generic Programming. PhD thesis, The University of Nottingham (2007)Google Scholar
  13. 13.
    Peyton Jones, S., Vytiniotis, D., Weirich, S., Washburn, G.: Simple unification-based type inference for GADTs. In: ICFP 2006, pp. 50–61 (2006)Google Scholar
  14. 14.
    Spivey, M.: Combinators for breadth-first search. Journal of Functional Programming 10(4), 397–408 (2000)zbMATHCrossRefMathSciNetGoogle Scholar
  15. 15.
    Weirich, S.: Higher-order intensional type analysis. In: Le Métayer, D. (ed.) ESOP 2002. LNCS, vol. 2305, pp. 98–114. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  16. 16.
    Xi, H., Chen, C., Chen, G.: Guarded recursive datatype constructors. In: POPL 2003, pp. 224–235 (2003)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2010

Authors and Affiliations

  • Alexey Rodriguez Yakushev
    • 1
  • Johan Jeuring
    • 2
    • 3
  1. 1.Vector Fabrics B.V.EindhovenThe Netherlands
  2. 2.Department of Information and Computing SciencesUtrecht UniversityUtrechtThe Netherlands
  3. 3.School of Computer ScienceOpen University of the NetherlandsHeerlenThe Netherlands

Personalised recommendations