Hi there, I am Francis, an independent consultant specialized in Scala and Functional Programming.

Functional Design

This is a long due post following the talks given recently at Dawscon, CodeMesh, and Scala Toronto about Functional Design (slides are available here). This post has been updated since its first publication. As noticed by Alwin and following this conversation, the name IO can be confusing so it has been replaced by Console. Considering the amount of material available today, Software Design is rather intimidating....

February 2, 2021

Composition

An efficient software design is one allowing its components to be separated and recombined without introducing unexpected behaviors. This topic has been tackled over and over in the past and different approaches like the SOLID principles or the GOF patterns eventually came up to address this problem. Despite their value, these tend to confuse many software developers however. Taken separately, they may indeed sound incomplete and often fail to convey what ties them all together....

September 22, 2020

Newtype

In the previous post, we briefly covered how a typeclass can be implemented and ended up asking ourselves how multiple implementations of a typeclass could be done for the same data type while not compromising the implicit mechanism (in other words, type class coherency). This technique has been deeply covered in a Spartan session presented by John De Goes, and this is a small teaser of what one can learn while attending his course:...

April 11, 2020

Typeclasses

Typeclasses are a very common topic when tackling Functional Programming and is what enables abstraction over similar (and possibly unrelated) data-structures. Traditional approach In Object-Oriented Programming, this is usually achieved using an interface or an abstract class. trait Json trait JSonSerializable { def toJson: Json } def serialize[A <: JsonSerializable](a: A): Json = a.toJson class Person extends JSonSerializable { override def toJson: Json = ??? } Despite being pretty simple to understand, this approach comes with several issues....

April 9, 2020

HList

The Heterogeneous List aka HList is a pretty well-known data structure in the functional / type programming world and is a very interesting topic to cover as it can teach us a lot about Scala’s type system in general. John A. De Goes recently used this concept to model an SQL language in a typesafe fashion and presented its work in a Spartan session. The problem tackled by HLists is about storing elements of different types (that is heterogeneous elements) and retaining information about these types at the same time....

February 29, 2020