All Stories

Lifting in Scala

Partial functions are widely used in Scala. Just like their mathematical counterpart, a partial function, e.g f: X => Y, is a generalisation of functions, that don’t necessarily map every...

Story of flatMap()

The function flatMap, in Scala, is basically a binding element (and also a functional combinator) in the language and key to understand some important concepts of functional programming, and in...

Scala Companion Objects

It’s a very common approach to create new objects using factory methods in object-oriented programming as it is in Java. It allows us to decrease coupling between software components while...