Incremental multi-level input processing with left-fold enumerator - predictable, high-performance, safe, and elegant We explain input processing with left-fold enumerator, using as an example HTTP request processing in Haskell. The talk is aimed at practitioners, in particular, server programmers. That is, programmers who program long-running distributed applications and are painfully aware of the issues of reading from sockets, latency, buffering, many layers of decoding, proper resource disposal and sustaining high load. In short, anyone who programmed a network server, a database back-end, or a high-volume data format transcoder. Some familiarity with Haskell is assumed. We focus on: -- high-performance: block-based i/o, low-latency, incremental processing in constant memory; -- correctness: predictable resource usage, timely deallocation, preventing access to disposed resources; -- elegance: writing input processing without worrying about input buffer underflows, chunk- and UTF-8 decoding, implementing look-ahead We achieve both high performance and encapsulation of input processing layers that can be freely composed. The technique has been validated in a production web-application server written in Haskell and database access library Takusen. The talk aims at practitioners not afraid of Haskell. The left-fold enumerator as a general concept has been used in other functional languages. For simplicity all the discussed code uses file IO rather than network sockets. Therefore, attendees only need some recent version of GHC (I think even GHC 6.4.2 would do). Since I will be demonstrating only file-based IO, the operating system does not matter. All the code will be available on-line (some of it is already written...). ------------------------------------------------------------------------ Oleg Kiselyov is a computer scientist in Monterey, CA. He has implemented a weather distribution system described in a paper Implementing Metcast in Scheme Higher-Order and Symbolic Computation, 18(3-4): 355-370 (2005) The system has been in the continuous round-the-clock operation since 1999. The latest version of the system is partly re-written in Haskell.