iOffice has been using Scala in production for over 5 years. During this time, we have naturally shifted from using it as a "better Java" to a more idiomatic functional Scala. Over the last 12 to 18 months we faced challenges that pushed us even further down the Functional Programming path. The results of this journey have been really exciting, and we think this style of Strongly Typed Pure Functional Programming can help any individual or organisation have greater confidence in the code they deploy to production.
In this talk we will go on a whirlwind tour of the Scala Pure Functional Library ecosystem as we implement an example application that mirrors one currently running in production at iOffice. We will start with the design of the application. This process begins by abstracting over the outside world to implement our business logic in purely functional, isolated and easily testable way. Once our foundation is established, we move on to utilizing the rich library ecosystem to implement the means by which our application will interact with the world whilst retaining its pure nature. Finally, we will wire everything together and have a fully functioning example of a Strongly Typed Pure Functional Scala Application that is ready to deploy to production. Some of the libraries we will encounter are:
- Scalaz, which defines a set of foundational type classes and provides purely functional data structures to complement those from the Scala standard library
- ZIO, which is a general purpose effect monad, and associated abstractions that provide type-safe, composable concurrency for Scala
- Http4s, a minimal idiomatic Scala interface for Http Services
- Doobie, a pure functional JDBC layer for Scala
- FS2, a compositional, streaming I/O library for Scala
We will see how the power of abstraction has enabled the authors of these libraries to build on a core set of fundamental concepts that allow these libraries to be perfectly composable while having zero dependencies on each other.