Abstract

Consider this simple Haskell definition, of a function which counts the number of occurrences of a given word w in a string:

count w = length . filter (==w) . words

This is an example of “point-free” programming style, where we build a function by composing others, and make heavy use of higher-order functions such as filter. Point-free programming is rightly popular: used appropriately, it makes for concise and readable definitions, which are well suited to equational reasoning in the style of Bird and Meertens [2]. It’s also a natural way to assemble programs from components, and closely related to connecting programs via pipes in the UNIX shell.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Benton, N., Hyland, M.: Traced premonoidal categories. ITA 37(4), 273–299 (2003)MATHMathSciNetGoogle Scholar
  2. 2.
    Bird, R.S.: A calculus of functions for program derivation. In: Turner, D. (ed.) Research Topics in Functional Programming. Addison-Wesley, Reading (1990)Google Scholar
  3. 3.
    Carlsson, M., Hallgren, T.: FUDGETS - A graphical user interface in a lazy functional language. In: Proceedings of the ACM Conference on Functional Programming and Computer Architecture, Copenhagen. ACM, New York (1993)Google Scholar
  4. 4.
    Claessen, K., Hughes, J.: Quickcheck: A lightweight tool for random testing of Haskell programs. In: International Conference on Functional Programming (ICFP), ACM SIGPLAN (2000)Google Scholar
  5. 5.
    Courtney, A., Elliott, C.: Genuinely functional user interfaces. In: Haskell Workshop, Firenze, Italy, pp. 41–69 (2001)Google Scholar
  6. 6.
    Courtney, A., Nilsson, H., Paterson, R.: Arrows: A general interface to computation, http://www.haskell.org/arrows/
  7. 7.
  8. 8.
    Hudak, P., Courtney, A., Nilsson, H., Peterson, J.: Arrows, robots, and functional reactive programming. In: Summer School on Advanced Functional Programming 2002, Oxford University. LNCS, vol. 2638, pp. 159–187. Springer, Heidelberg (2003)Google Scholar
  9. 9.
    Hughes, J.: Restricted Datatypes in Haskell. In: Third Haskell Workshop. Utrecht University technical report (1999)Google Scholar
  10. 10.
    Hughes, J.: Generalising monads to arrows. Science of Computer Programming 37(1–3), 67–111 (2000)MATHCrossRefMathSciNetGoogle Scholar
  11. 11.
    Jansson, P., Jeuring, J.: Polytypic data conversion programs. Science of Computer Programming 43(1), 35–75 (2002)MATHCrossRefMathSciNetGoogle Scholar
  12. 12.
    Launchbury, J., Lewis, J.R., Cook, B.: On embedding a microarchitectural design language within Haskell. In: ICFP, Paris, pp. 60–69. ACM Press, New York (1999)Google Scholar
  13. 13.
    Liang, S., Hudak, P., Jones, M.P.: Monad transformers and modular interpreters. In: Symposium on Principles of Programming Languages, San Francisco, January 1995, ACM SIGPLAN-SIGACT (1995)Google Scholar
  14. 14.
    Moggi, E.: Computational lambda-calculus and monads. In: Proceedings 4th Annual IEEE Symp. on Logic in Computer Science, LICS 1989, Pacific Grove, CA, USA, June 5-8, 1989, pp. 14–23. IEEE Computer Society Press, Washington (1989)Google Scholar
  15. 15.
    Sheeran, M., Bjesse, P., Claessen, K., Singh, S.: Lava: Hardware design in Haskell. In: ICFP. ACM Press, New York (1998)Google Scholar
  16. 16.
    Paterson, R.: Arrow transformer library, http://www.haskell.org/arrows/download.html
  17. 17.
    Paterson, R.: A new notation for arrows. In: ICFP, Firenze, Italy. ACM, New York (2001)Google Scholar
  18. 18.
    Paterson, R.: Arrows and computation. In: Gibbons, J., Moor, O.D. (eds.) The Fun of Programming. Palgrave (2003)Google Scholar
  19. 19.
    Achten, R.P.P., van Eekelen, M.: Arrows for generic graphical editor components. Technical Report NIII-R0416, Nijmegen Institute for Computing and Information Sciences, University of Nijmegen (2004)Google Scholar
  20. 20.
    Peyton-Jones, S., Washburn, G., Weirich, S.: Wobbly types: type inference for generalised algebraic data types (July 2004), http://research.microsoft.com/Users/simonpj/papers/gadt/index.htm
  21. 21.
    Pierce, C.: Basic Category Theory for Computer Scientists. MIT Press, Cambridge (1991)Google Scholar
  22. 22.
    Power, J., Robinson, E.: Premonoidal categories and notions of computation. Mathematical Structures in Computer Science 7(5), 453–468 (1997)MATHCrossRefMathSciNetGoogle Scholar
  23. 23.
    Power, J., Thielecke, H.: Closed Freyd- and κ-categories. In: Wiedermann, J., Van Emde Boas, P., Nielsen, M. (eds.) ICALP 1999. LNCS, vol. 1644, pp. 625–634. Springer, Heidelberg (1999)CrossRefGoogle Scholar
  24. 24.
    Swierstra, D.S., Duponcheel, L.: Deterministic, error-correcting combinator parsers. In: Launchbury, J., Meijer, E., Sheard, T. (eds.) Advanced Functional Programming. LNCS, vol. 1129, pp. 184–207. Springer, Heidelberg (1996)Google Scholar
  25. 25.
    Thiemann, P.: WASH/CGI: Server-side web scripting with sessions and typed, compositional forms. In: Practical Aspects of Declarative Languages, pp. 192–208 (2002)Google Scholar
  26. 26.
    Wadler, P.L.: Comprehending monads. In: Proceedings of the 1990 ACM Conference on LISP and Functional Programming, Nice, pp. 61–78. ACM, New York (1990)CrossRefGoogle Scholar
  27. 27.
    Wallace, M., Runciman, C.: Haskell and XML: Generic combinators or type-based translation? In: International Conference on Functional Programming, pp. 148–159. ACM Press, New York (1999)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2005

Authors and Affiliations

  • John Hughes
    • 1
  1. 1.Department of Computer Science and EngineeringChalmers University of TechnologyGöteborgSweden

Personalised recommendations