This guest post was written by Gabriel Volpe for Signify Technology, back in November 2016. Gabriel has over 8 years of experience, for the last 3 years he has been deeply involved in Functional Programming using Scala designing and developing reactive architectures.
With the recent release of Cats v1.0 it’s incredibly amazing how Scala’s pure FP ecosystem around it has matured. It’s worth mentioning and remarking the hard work of the entire community behind these Typelevel projects such as Cats Effect, Fs2, Http4s and Circe and I must confess, it’s been and is currently my favorite tech stack in Scala.
It is described as the standard IO for the Cats ecosystem in order to manage both synchronous and asynchronous (callback-driven) effects. The current version is v0.5 dependent on Cats v1.0.0-RC1.
It currently is the main effect type F[_] : Effect used by the latest versions of Fs2, Http4s and Circe.
Or Functional Streams for Scala (formerly Scalaz-Stream), is a pure functional streaming I/O library, currently focusing the effort on the upcoming release of the version 0.10 (current version is v0.10.0-M8dependent on Cats Effect v0.5). It has suffered many transformations but it has now reached a mature state which I consider production ready.
The main effect type used in previous versions was fs2.Task, and previously scalaz.concurrent.Task when it was Scalaz Stream, but it has now been removed in favor of the new standard cats.effect.Effect.
Described as “A Json library for Scala powered by Cats”, has also upgraded to the latest version of Cats v1.0.0-RC1 offering the milestone v0.9.0-M2, and on the way to release its stable version. It is the default library chosen by Fs2 and Http4s for Json manipulation.
“A pure functional JDBC layer for Scala and Cats” that provides a principled way to construct programs (and higher-level libraries) that use JDBC. The latest version is v0.5.0-M9 dependent on the latest Fs2 v0.10.0-M8 and Cats 1.0.0-RC1.
“A minimal and idiomatic Scala interface for HTTP”, as described in the main web site. In an incredible team effort, they are currently maintaining four different versions (0.15.x, 0.16.x, 0.17.x and 0.18.x), hats off to the team! The latest version is v0.18.0-M5dependent on the latest Fs2 v0.10.0-M8 and Cats Effect v0.5.
Use Case Scenarios
In the last few months I’ve been working on Smart Backpacker, an application for travelers where you can find information such as Visa Requirements, Currency Exchange and Airline’s Baggage Policy. If you are an Android user you can try it out right now (download it here). However, iOS users must wait until the end of the year where I hope we can have it ready (currently being developed by my friend @sheinix).
The backend is written in Scala (as you might already guessed) using a few of the libraries described above such as Http4s, Cats Effect and Circe. The Android App has been written 100% by me (I must say I hate dealing with XML and Android layouts) but it wasn’t so bad to do it while learning Kotlin at the same time. I plan to release both projects as open source next year so stay tuned!
Also, recently I’ve been challenged to solve an exercise involving the creation of a User Http API on top of an existent backend service. The requirements, in my understanding, require authentication so I went for Http4s Auth (first time using it) and as I expected works like a charm! Special thanks to @rossabaker who was extremely helpful and friendly in the Http4s Gitter channel when I asked for help regarding the Auth feature.
I’m just super excited about all of what’s going on in the Scala ecosystem right now. The future looks brighter than ever… Keep on rocking Scalars!
If you are interested in Gabriel’s article or have any questions, contact Signify Technology for more information. If you would like to feature your own guest blog post, please email email@example.com