1. Customizing Circe's auto generic derivation

    While modeling the domain I often use sealed trait hierarchies, value classes, and case classes. They are essential for idiomatic Scala code. However, the encoding and decoding them to JSON can be problematic. Even though Circe provides boilerplate-free generic derivation, the JSON encoded using the default configuration may be confusing. In this post, I describe how to make it more friendly.

    circe, configuration, json, scala, shapeless, typelevel

  2. Parallel futures and exceptions

    Asynchronous applications are much harder to debug. You do not get the whole stack trace so easily. So it is important to react to all the exceptions that might unexpectedly occur. I found a case when following a simple pattern to run futures in parallel leads to loss of exceptions. In this post I describe a solution for that.

    applicative, exception, future, scala

  3. Getting started with emacs for scala programming

    This month I switched to emacs for scala programming. I was tired of the IntelliJ IDEA slowness and the fact that it consumes lots of CPU and memory. It works great for java, but with scala it’s unpleasant. Then I discovered spacemacs and ensime. I felt a relief. I find it much more ergonomic and faster IDE for scala. However, the beginnings are hard. I wrote this post to help you with the firsts steps in emacs.

    emacs, ensime, evil, osx, scala, spacemacs, vim

  4. For-comprehensions with Combined Monads

    The code should be easy to read. One of the programming principles to make the code more readable is to avoid nested operations. The so-called pyramid of doom does not only refers to callback hell in javascript but ofter appear in scala as well. Here, I describe how to make the for-comprehensions more elegant when using combined monads in scala.

    either, for-comprehension, future, http4s, monad transformers, option, scala, scalaz

  5. Lazy Fibonacci numbers

    A function which lazily produce fibonacci numbers implemented in some popular languages.

    alghorithm, clojure, fibonacci, functional, haskell, lazy, numbers, scala

  6. Streaming of data using http4s and scalaz-stream

    Http4s and scalaz-stream are good alternatives for akka-http and akka-stream. In this post, I show how easy it is to stream data over HTTP using them. Streaming allows to operate on heavy data without the necessity to store it in the memory. With http4s, it is just a few lines of code.

    http4s, idiomatic, non-blocking, scala, scalaz-stream

  7. Blocking and non-blocking frameworks

    In my master thesis I evaluated performance of blocking and non-blocking web frameworks in the context of distributed RESTful micro services. Non-blocking frameworks tend to have higher scalability as the processor is not wasted on context switching between threads. This post summarizes my findings.

    blocking, future, java, jvm, microservices, non-blocking, scala, web framework

  8. HMAC Authentication

    Recently I was working on yet another startup project (mobile app with backend). The goal was to make the backend stateless and highly scalable. I did not want to maintain sessions. So I was looking for authentication and authorization mechanism for RESTful APIs which is scalable, secure and appropriate for mobile. The solution was HMAC. This post describes how to handle it using spray.io.

    angularjs, authentication, hmac, js, scala, security, spray