Skip to main content

Deriving a Relationship from a Single Example

  • Conference paper
Approaches and Applications of Inductive Programming (AAIP 2009)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 5812))

  • 608 Accesses

Abstract

Given an appropriate domain specific language (DSL), it is possible to describe the relationship between Haskell data types and many generic functions, typically type-class instances. While describing the relationship is possible, it is not always an easy task. There is an alternative – simply give one example output for a carefully chosen input, and have the relationship derived.

When deriving a relationship from only one example, it is important that the derived relationship is the intended one. We identify general restrictions on the DSL, and on the provided example, to ensure a level of predictability. We then apply these restrictions in practice, to derive the relationship between Haskell data types and generic functions. We have used our scheme in the Derive tool, where over 60% of type classes are derived from a single example.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Augustsson, L.: Putting Curry-Howard to work. In: AAIP 2009: Proceedings of the ACM SIGPLAN Workshop on Approaches and Applications of Inductive Programming, p. 1 (2009)

    Google Scholar 

  2. Broberg, N.: Haskell-src-exts (2009), http://www.cs.chalmers.se/~d00nibro/haskell-src-exts/

  3. Claessen, K., Hughes, J.: QuickCheck: A lightweight tool for random testing of Haskell programs. In: Proc. ICFP 2000, pp. 268–279. ACM Press, New York (2000)

    Chapter  Google Scholar 

  4. Fluet, M., Pucella, R.: Phantom types and subtyping. In: Proc. TCS 2002, Deventer, The Netherlands, pp. 448–460 (2002)

    Google Scholar 

  5. Gamma, E., Helm, R., Johnson, R., Vlissides, J.: Design patterns: elements of reusable object-oriented software. Addison-Wesley Professional, Reading (1995)

    Google Scholar 

  6. Goldberg, D.E.: Genetic Algorithms in Search, Optimization, and Machine Learning. Addison-Wesley Professional, Reading (1989)

    MATH  Google Scholar 

  7. Golubovsky, D., Mitchell, N., Naylor, M.: Yhc.Core – from Haskell to Core. The Monad. Reader 1(7), 45–61 (2007)

    Google Scholar 

  8. Harrison, J.: HOL light: A tutorial introduction. In: Srivas, M., Camilleri, A. (eds.) FMCAD 1996. LNCS, vol. 1166, pp. 265–269. Springer, Heidelberg (1996)

    Chapter  Google Scholar 

  9. Hinze, R., Peyton Jones, S.: Derivable type classes. In: Hutton, G. (ed.) Proc. Haskell Workshop 2000. Elsevier Science, Amsterdam (2000)

    Google Scholar 

  10. Hughes, J.: The design of a pretty-printing library. In: Jeuring, J., Meijer, E. (eds.) AFP 1995. LNCS, vol. 925, pp. 53–96. Springer, Heidelberg (1995)

    Google Scholar 

  11. Jeuring, J., Rodriguez, A., Smeding, G.: Generating generic functions. In: WGP 2006: Proceedings of the 2006 ACM SIGPLAN workshop on Generic programming, pp. 23–32. ACM, New York (2006)

    Chapter  Google Scholar 

  12. Katayama, S.: Efficient exhaustive generation of functional programs using Monte-Carlo search with iterative deepening. In: Ho, T.-B., Zhou, Z.-H. (eds.) PRICAI 2008. LNCS (LNAI), vol. 5351, pp. 199–210. Springer, Heidelberg (2008)

    Chapter  Google Scholar 

  13. Kitzelmann, E.: Data-driven induction of recursive functions from input/output-examples. In: Proceedings of the Workshop on Approaches and Applications of Inductive Progamming (AAIP 2007), pp. 15–26 (2007)

    Google Scholar 

  14. Kitzelmann, E.: Data-driven induction of functional programs. In: Proc. ECAI 2008. IOS Press, Amsterdam (2008)

    Google Scholar 

  15. Kitzelmann, E., Schmid, U.: Inductive synthesis of functional programs – An explanation based generalization approach. Journal of Machine Learning Research 7, 429–454 (2006)

    MathSciNet  Google Scholar 

  16. Lämmel, R., Peyton Jones, S.: Scrap your boilerplate: a practical design pattern for generic programming. In: Proc. TLDI 2003, pp. 26–37. ACM Press, New York (2003)

    Chapter  Google Scholar 

  17. Lämmel, R., Peyton Jones, S.: Scrap more boilerplate: reflection, zips, and generalised casts. In: Proc. ICFP 2004, pp. 244–255. ACM Press, New York (2004)

    Chapter  Google Scholar 

  18. Marlow, S.: Haddock, a Haskell documentation tool. In: Proc. Haskell Workshop 2002, Pittsburgh Pennsylvania, USA. ACM Press, New York (2002)

    Google Scholar 

  19. Mintchev, S.: Mechanized reasoning about functional programs. In: Hammond, K., Turner, D.N., Sansom, P.M. (eds.) Functional Programming, pp. 151–166. Springer, Heidelberg (1994)

    Google Scholar 

  20. Mitchell, N.: Deriving generic functions by example. In: Mühlberg, J.T., Perna, J.I. (eds.) Proc. York Doctoral Symposium 2007, October 2007, pp. 55–62. Tech. Report YCS-2007-421, University of York (2007)

    Google Scholar 

  21. Mitchell, N., O’Rear, S.: Derive - project home page (2009), http://community.haskell.org/~ndm/derive/

  22. Peyton Jones, S.: Haskell 98 Language and Libraries: The Revised Report. Cambridge University Press, Cambridge (2003)

    Google Scholar 

  23. Peyton Jones, S., Vytiniotis, D., Weirich, S., Washburn, G.: Simple unification-based type inference for GADTs. In: Proc. ICFP 2006, pp. 50–61. ACM Press, New York (2006)

    Chapter  Google Scholar 

  24. Sheard, T., Peyton Jones, S.: Template meta-programming for Haskell. In: Proc. Haskell Workshop 2002, pp. 1–16. ACM Press, New York (2002)

    Chapter  Google Scholar 

  25. The GHC Team. The GHC compiler, version 6.10.3 (May 2009), http://www.haskell.org/ghc/

  26. The Yhc Team. The York Haskell Compiler – user manual (February 2007), http://www.haskell.org/haskellwiki/Yhc

  27. Trinder, P., Hammond, K., Loidl, H.-W., Peyton Jones, S.: Algorithm + strategy = parallelism. JFP 8(1), 23–60 (1998)

    Article  MATH  MathSciNet  Google Scholar 

  28. Wadler, P.: How to replace failure by a list of successes. In: Proc. FPCA 1985, pp. 113–128. Springer-Verlag New York, Inc. (1985)

    Google Scholar 

  29. Wadler, P., Blott, S.: How to make ad-hoc polymorphism less ad hoc. In: Proc. POPL 1989, pp. 60–76. ACM Press, New York (1989)

    Google Scholar 

  30. Winstanley, N.: Reflections on instance derivation. In: 1997 Glasgow Workshop on Functional Programming. BCS Workshops in Computer Science (September 1997)

    Google Scholar 

Download references

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2010 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Mitchell, N. (2010). Deriving a Relationship from a Single Example. In: Schmid, U., Kitzelmann, E., Plasmeijer, R. (eds) Approaches and Applications of Inductive Programming. AAIP 2009. Lecture Notes in Computer Science, vol 5812. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-11931-6_1

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-11931-6_1

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-11930-9

  • Online ISBN: 978-3-642-11931-6

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics