Nilanjan is a consultant/trainer and core member of Play framework. He works for Typesafe. He has more than 12 years of experience managing and developing software solutions in Java, Ruby, Groovy and also in Scala. 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.
YOW! Lambda Jam 2013 Brisbane
Functional I/O in Scala
WORKSHOP – VIEW SLIDES
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: http://www.scala-sbt.org/#install