Hostname: page-component-586b7cd67f-rdxmf Total loading time: 0 Render date: 2024-12-04T08:16:05.311Z Has data issue: false hasContentIssue false

Applicative programming with effects

Published online by Cambridge University Press:  01 January 2008

CONOR MCBRIDE
Affiliation:
University of Nottingham
ROSS PATERSON
Affiliation:
City University, London
Rights & Permissions [Opens in a new window]

Abstract

Core share and HTML view are not available for this content. However, as you have access to this content, a full PDF is available via the ‘Save PDF’ action button.

In this article, we introduce Applicative functors – an abstract characterisation of an applicative style of effectful programming, weaker than Monads and hence more widespread. Indeed, it is the ubiquity of this programming pattern that drew us to the abstraction. We retrace our steps in this article, introducing the applicative pattern by diverse examples, then abstracting it to define the Applicative type class and introducing a bracket notation that interprets the normal application syntax in the idiom of an Applicative functor. Furthermore, we develop the properties of applicative functors and the generic operations they support. We close by identifying the categorical structure of applicative functors and examining their relationship both with Monads and with Arrow.

Type
Functional Pearls
Copyright
Copyright © Cambridge University Press 2007

References

Baars, A., Löh, A. & Swierstra, S. D. (2004) Parsing permutation phrases. Journal of Functional Programming, 14 (6), 635646.CrossRefGoogle Scholar
Barr, M. & Wells, C. (1984) Toposes, Triples and Theories. Grundlehren der Mathematischen Wissenschaften, no. 278. New York:Springer, Chap. 9.Google Scholar
Coutts, D. (2002) Arrows for Errors: Extending the Error Monad. Unpublished presentation at the Summer School on Advanced Functional Programming.Google Scholar
Fridlender, D. & Indrika, M. (2000) Do we need dependent types? Journal of Functional Programming, 10 (4), 409415.CrossRefGoogle Scholar
Hughes, J. (2000) Generalising monads to arrows. Science of Computer Programming, 37 (1–3), 67111.CrossRefGoogle Scholar
Hutton, G. & Meijer, E. (1998) Monadic parsing in Haskell. Journal of Functional Programming, 8 (4), 437444.CrossRefGoogle Scholar
Leijen, D. & Meijer, E. (1999) Domain specific embedded compilers. 2nd Conference on Domain-Specific Languages (DSL). USENIX, Austin, TX, USA.CrossRefGoogle Scholar
Meertens, L. (1998) Functor pulling. Workshop on Generic Programming (WGP'98). Marstrand, Sweden: Chalmers University of Technology.Google Scholar
Peyton Jones, S. (ed). (2003) Haskell 98 Language and Libraries: The Revised Report. Cambridge University Press.Google Scholar
Power, J. & Robinson, E. (1997) Premonoidal categories and notions of computation. Mathematical Structures in Computer Science, 7 (5), 453468.CrossRefGoogle Scholar
Röjemo, N. (1995) Garbage Collection and Memory Efficiency in Lazy Functional Languages. Ph.D. thesis, Chalmers University of Technology and Göteborg University.Google Scholar
Swierstra, S. D. & Duponcheel, L. (1996) Deterministic, error-correcting combinator parsers. Pages 184–207 of: Launchbury, J., Meijer, E. & Sheard, T. (eds), Advanced Functional Programming. LNCS, vol. 1129. Springer.Google Scholar
Wadler, P. (1985) How to replace failure by a list of successes. Pages 113–128 of: Jouannaud, J.-P. (ed), Functional Programming Languages and Computer Architecture. LNCS, vol. 201. Springer.Google Scholar
Submit a response

Discussions

No Discussions have been published for this article.