Internal DSL design in Scala

A domain-specific language (DSL) is a language that you design with a specific domain in mind. There are two types of domain-specific languages (DSLs): external and internal. The former implicates — in the simplest case — parsing a string into the programming language syntax. The latter, on the other hand, involves implementing a language within your own programming language. Quoting Martin Fowler, “Internal DSLs are particular ways of using a host language to give the host language the feel of a particular language”. In this session you’ll see how to implement a simple but complete internal DSL in Scala. You’ll see that Scala syntax has some important features that makes it a DSL-friendly language.

Conference: NoSlidesConf | Location: Bologna, Italy | Date: 25 November, 2017 | Video

Raising the abstraction level with HKTs and type classes

I suppose it’s an objective of every developer writing reusable code. Statically typed FP and higher-kinded types lets you raise the abstraction level enormously with respect to OOP and, more generally, languages which don’t have HKTs and type classes. In this talk, after an introduction to some funny-named type classes, you’ll see how to take advantage of them to implement a very reusable function. I’ll start by implementing it using a quick & dirty approach and then trying to make it more abstract and reusable thanks to more or less known type classes, actually making sense of them so you can see they are not just confined to theory and useless in practice.

Conference: Scala Italy | Location: Rome, Italy | Date: 13 May, 2017 | Slides | Video

Monad and friends demystified

In questo talk vedremo alcuni dei design pattern del mondo funzionale. Concetti come Functor e Monad possono essere affrontati attraverso due diversi approcci:

  1. Usando una branca della matematica che risponde al nome di Teoria delle Categorie.

  2. Utilizzando un approccio più pragmatico e lasciando i dettagli squisitamente teorici per un secondo momento, quando ognuno si sentirà pronto per approfondire l’argomento.

In questo talk opteremo per l’approccio pratico, cercando di rendere digeribili a tutti gli argomenti trattati.

Infine daremo una rapida occhiata a cats, libreria che, similarmente a scalaz, enfatizza l’uso di questi design pattern funzionali.

Conference: Milano Scala Group | Location: Milan, Italy | Date: 24 March, 2016 | Slides | Video