Skip to main content

Iteratees

  • Conference paper
Book cover Functional and Logic Programming (FLOPS 2012)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 7294))

Included in the following conference series:

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.

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. Claessen, K.: Parallel parsing processes. Journal of Functional Programming 14(6), 741–757 (2004)

    Article  MATH  Google Scholar 

  2. Collins, G.D.: snap-server: An iteratee-based http server library (2011), http://snapframework.com/docs/latest/snap-server/index.html

  3. Harrison, W.L.: The Essence of Multitasking. In: Johnson, M., Vene, V. (eds.) AMAST 2006. LNCS, vol. 4019, pp. 158–172. Springer, Heidelberg (2006)

    Chapter  Google Scholar 

  4. Hinze, R.: Deriving backtracking monad transformers. In: ICFP, pp. 186–197. ACM Press (2001)

    Google Scholar 

  5. 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)

    Google Scholar 

  6. Lato, J.W.: Iteratee: Teaching an old fold new tricks. In: Yorgey, B. (ed.) The Monad.Reader, vol. 16, pp. 19–35 (2010)

    Google Scholar 

  7. Launchbury, J., Peyton Jones, S.L.: State in Haskell. Journal Lisp and Symbolic Computation 8(4), 293–341 (1995)

    Article  Google Scholar 

  8. Millikin, J.: Understanding iteratees (2010), http://john-millikin.com/articles/understanding-iteratees/

  9. Parker, C.: Iteratees at Tsuru Capital (2011), http://blog.kfish.org/2011/09/iteratees-at-tsuru.html

  10. Quick, K.: Fun with the ST monad (2011), http://www.haskell.org/pipermail/haskell-cafe/2011-February/089689.html

  11. de Rauglaudre, D.: Camlp4 - Reference Manual, version 3.07 (2003), http://caml.inria.fr/pub/docs/manual-camlp4/

  12. 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)

    Article  MATH  Google Scholar 

  13. 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)

    Chapter  Google Scholar 

  14. Swierstra, W.: Data types á la carte. Journal of Functional Programming 18(4), 423–436 (2008)

    Article  MathSciNet  MATH  Google Scholar 

  15. 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)

    Chapter  Google Scholar 

  16. Thornton, W.N.: Fun with the ST monad (2011), http://www.haskell.org/pipermail/haskell-cafe/2011-February/089687.html

  17. Yamamoto, K.: A tutorial on the enumerator library (2011), http://www.mew.org/~kazu/proj/enumerator/

  18. Yang, E.Z.: Why iteratees are hard to understand (2012), http://blog.ezyang.com/2012/01/why-iteratees-are-hard-to-understand/

Download references

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints 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)

Publish with us

Policies and ethics