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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Benton, N., Hyland, M.: Traced premonoidal categories. ITA 37(4), 273–299 (2003)
Bird, R.S.: A calculus of functions for program derivation. In: Turner, D. (ed.) Research Topics in Functional Programming. Addison-Wesley, Reading (1990)
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)
Claessen, K., Hughes, J.: Quickcheck: A lightweight tool for random testing of Haskell programs. In: International Conference on Functional Programming (ICFP), ACM SIGPLAN (2000)
Courtney, A., Elliott, C.: Genuinely functional user interfaces. In: Haskell Workshop, Firenze, Italy, pp. 41–69 (2001)
Courtney, A., Nilsson, H., Paterson, R.: Arrows: A general interface to computation, http://www.haskell.org/arrows/
English, J.: Hxml, http://www.flightlab.com/~joe/hxml/
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)
Hughes, J.: Restricted Datatypes in Haskell. In: Third Haskell Workshop. Utrecht University technical report (1999)
Hughes, J.: Generalising monads to arrows. Science of Computer Programming 37(1–3), 67–111 (2000)
Jansson, P., Jeuring, J.: Polytypic data conversion programs. Science of Computer Programming 43(1), 35–75 (2002)
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)
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)
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)
Sheeran, M., Bjesse, P., Claessen, K., Singh, S.: Lava: Hardware design in Haskell. In: ICFP. ACM Press, New York (1998)
Paterson, R.: Arrow transformer library, http://www.haskell.org/arrows/download.html
Paterson, R.: A new notation for arrows. In: ICFP, Firenze, Italy. ACM, New York (2001)
Paterson, R.: Arrows and computation. In: Gibbons, J., Moor, O.D. (eds.) The Fun of Programming. Palgrave (2003)
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)
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
Pierce, C.: Basic Category Theory for Computer Scientists. MIT Press, Cambridge (1991)
Power, J., Robinson, E.: Premonoidal categories and notions of computation. Mathematical Structures in Computer Science 7(5), 453–468 (1997)
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)
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)
Thiemann, P.: WASH/CGI: Server-side web scripting with sessions and typed, compositional forms. In: Practical Aspects of Declarative Languages, pp. 192–208 (2002)
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)
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)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2005 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Hughes, J. (2005). Programming with Arrows. In: Vene, V., Uustalu, T. (eds) Advanced Functional Programming. Lecture Notes in Computer Science, vol 3622. Springer, Berlin, Heidelberg. https://doi.org/10.1007/11546382_2
Download citation
DOI: https://doi.org/10.1007/11546382_2
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-28540-3
Online ISBN: 978-3-540-31872-9
eBook Packages: Computer ScienceComputer Science (R0)