Abstract
Iteratee IO is a style of incremental input processing with precise resource control. The style encourages building input processors from a user-extensible set of primitives by chaining, layering, pairing and other modes of compositions. The programmer is still able, where needed, to precisely control look-ahead, the allocation of buffers, file descriptors and other resources. The style is especially suitable for processing of communication streams, large amount of data, and data undergone several levels of encoding such as pickling, compression, chunking, framing. It has been used for programming high-performance (HTTP) servers and web frameworks, in computational linguistics and financial trading.
We exposit programming with iteratees, contrasting them with Lazy IO and the Handle-based, |stdio|-like IO. We relate them to online parser combinators. We introduce a simple implementation as free monads, which lets us formally reason with iteratees. As an example, we validate several equational laws and use them to optimize iteratee programs. The simple implementation helps understand existing implementations of iteratees and derive new ones.
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
Claessen, K.: Parallel parsing processes. Journal of Functional Programming 14(6), 741–757 (2004)
Collins, G.D.: snap-server: An iteratee-based http server library (2011), http://snapframework.com/docs/latest/snap-server/index.html
Harrison, W.L.: The Essence of Multitasking. In: Johnson, M., Vene, V. (eds.) AMAST 2006. LNCS, vol. 4019, pp. 158–172. Springer, Heidelberg (2006)
Hinze, R.: Deriving backtracking monad transformers. In: ICFP, pp. 186–197. ACM Press (2001)
Kiselyov, O.: Incremental multi-level input processing with left-fold enumerator: predictable, high-performance, safe, and elegant. In: ACM SIGPLAN 2008 Developer Tracks on Functional Programming (DEFUN 2008) (2008)
Lato, J.W.: Iteratee: Teaching an old fold new tricks. In: Yorgey, B. (ed.) The Monad.Reader, vol. 16, pp. 19–35 (2010)
Launchbury, J., Peyton Jones, S.L.: State in Haskell. Journal Lisp and Symbolic Computation 8(4), 293–341 (1995)
Millikin, J.: Understanding iteratees (2010), http://john-millikin.com/articles/understanding-iteratees/
Parker, C.: Iteratees at Tsuru Capital (2011), http://blog.kfish.org/2011/09/iteratees-at-tsuru.html
Quick, K.: Fun with the ST monad (2011), http://www.haskell.org/pipermail/haskell-cafe/2011-February/089689.html
de Rauglaudre, D.: Camlp4 - Reference Manual, version 3.07 (2003), http://caml.inria.fr/pub/docs/manual-camlp4/
Shaw, M., Wulf, W.A., London, R.L.: Abstraction and verification in Alphard: defining and specifying iteration and generators. Communications of the ACM 20(8), 553–564 (1977)
Swierstra, S.D.: Combinator Parsing: A Short Tutorial. In: Bove, A., Barbosa, L.S., Pardo, A., Pinto, J.S. (eds.) LerNet ALFA Summer School 2008. LNCS, vol. 5520, pp. 252–300. Springer, Heidelberg (2009)
Swierstra, W.: Data types á la carte. Journal of Functional Programming 18(4), 423–436 (2008)
Tarau, P.: Fluents: A Refactoring of Prolog for Uniform Reflection and Interoperation with External Objects. In: Palamidessi, C., Moniz Pereira, L., Lloyd, J.W., Dahl, V., Furbach, U., Kerber, M., Lau, K.-K., Sagiv, Y., Stuckey, P.J. (eds.) CL 2000. LNCS (LNAI), vol. 1861, pp. 1225–1239. Springer, Heidelberg (2000)
Thornton, W.N.: Fun with the ST monad (2011), http://www.haskell.org/pipermail/haskell-cafe/2011-February/089687.html
Yamamoto, K.: A tutorial on the enumerator library (2011), http://www.mew.org/~kazu/proj/enumerator/
Yang, E.Z.: Why iteratees are hard to understand (2012), http://blog.ezyang.com/2012/01/why-iteratees-are-hard-to-understand/
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2012 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Kiselyov, O. (2012). Iteratees. In: Schrijvers, T., Thiemann, P. (eds) Functional and Logic Programming. FLOPS 2012. Lecture Notes in Computer Science, vol 7294. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-29822-6_15
Download citation
DOI: https://doi.org/10.1007/978-3-642-29822-6_15
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-29821-9
Online ISBN: 978-3-642-29822-6
eBook Packages: Computer ScienceComputer Science (R0)