I recently wrote about Event Sourcing and Free Monads. The natural next step is combining the two! How would a free monad adjusted for event sourcing look like? Please bear in mind that the below is just really a draft, not a complete solution. Hence any suggestions for improvements are…
Category: Functional programming
akka-stream vs scalaz-stream
I recently published a comparison of akka-stream and scalaz-stream, with code examples (same problems implemented using both libraries) on SoftwareMill’s blog.
Quicklens: traversing options and lists
Quicklens is a small library which allows to modify deeply nested fields in case classes e.g.: modify(person)(_.address.street.name).using(_.toUpperCase), without the need to create dedicated lens objects. I got some very good feedback on the initial release – thanks! There’s also a spin-off implementation, using a different syntax. One problem that I…
Quicklens: modify deeply nested case class fields
TL;DR: Quicklens: modify deeply nested fields in case classes, e.g.: modify(person)(_.address.street.name).using(_.toUpperCase). Similar to lenses, but without the actual lens creation. Lenses are very useful when you have to update a deeply nested field in a hierarchy of case classes. For example if we have: 1 2 3 4 5 case…
In today’s post-OO world, is dependency injection still relevant?
It’s 2015. Most of the new popular languages are more or less functional. The old ones, like Java, gain functional programming elements. In Scala, people are increasingly leaning towards the pure side, using more FP and less OO. So – Dependency Injection? Really? You could say that DI is just…
Functional Discrete Optimization @ Coursera with Scala
Recently I took part in the Discrete Optimization class at Coursera. I must say that it was the best MOOC I have attended so far, because of two factors. First of all, there was a lot of coding, and as a programmer, I like coding. The final grade depended only…
Traffic simulation game in Elm
A couple of weeks ago I read about Elm, a new functional language, which compiles to JavaScript and HTML. Elm is designed with the browser in mind, most notably by implementing Functional Reactive Programming (FRP). The syntax of Elm is Haskell-like, has only a few basic constructs and is very…
Missing OO and FP bridge in Scala
Scala blends functional and object-oriented programming in many nice ways. You can use both FP an OO-like constructs whichever fits the current problem better. But there’s always room for improvement! Here’s one thing I think is missing (short version at the bottom). FP side It’s easy to convert a method…