Functional I/O in Scala
YOW! Lambda Jam 2013
I/O is usually quite hard to tackle in a functional way. The predominant paradigm for I/O is the cursor. A cursor is a data structure that holds the current state of an I/O resource and provides a function to retrieve the next data available from that resource. This approach lacks some very properties we functional programmers care about:
- composability – Writing explicit I/O loops makes to hard to compose
- not functional – Ideally we write functions that transform input to output but pull based I/O (where you read the chunks) makes it hard to write pure functions
There are already libraries that provides some abstraction to overcome these shortcomings but somehow lacks in composability. In this presentation I will explore Enumeration based I/O with iteratee and how that makes I/O operations both functional and efficient. I will take some real world example use cases using Play framework where this approach has been used with success.
Come with your laptop running latest version of SBT. You can find the instructions right here: https://www.scala-sbt.org/#install
Nilanjan Raychaudhuri is a consultant/developer at Typesafe. He has more than 14 years of experience managing and developing software solutions for JVM. He is zealous about programming in Scala ever since he got introduced to this beautiful language. He enjoys sharing his experience via talks in various conferences and he is also the author of the “Scala in Action” book.
- Target Audience
- 1 hour 30min