Paul Chiusano

Functional programming, UX, tech, econ


Consulting services

I offer Scala and FP consulting services. If you're interested in working together, please contact me.

About my book

My book, Functional Programming in Scala, uses Scala as a vehicle for teaching FP. Read what people are saying about it.

Popular links

Unison: a next-gen programming platform the worldwide elastic computer (coming soon)
Type systems and UX: an example
CSS is unnecessary

A simple alternative to De Bruijn indexing, from ICFP 2013

There was a functional pearl at ICFP 2013 by Axelsson and Claessen that introduced a deceptively simple, useful technique for dealing with variable bindings in DSLs. Without any heavy machinery, it gives us HOAS-like syntax for constructing terms of the DSL, while retaining a simple first-order representation. The ‘library’ they developed is about 15 lines of code. When it was presented at ICFP, the audience was stunned. IIRC, there were no questions, as everyone was clearly wondering how the @^#$!! didn’t I think of that? I waited for someone in the audience to point out during the Q&A that this technique was FP folklore discovered by Alonzo Church in the 30s, but not a peep.


A very simple technique for making DSLs extensible

The heavyweight techniques for ‘solving’ the Expression Problem (Data types a la Carte (PDF) and some of the syntactically lighter weight extensible effect variants that popped up recently) are sometimes way overkill. Using the usual tools of abstraction, we can often make our DSLs extensible without any fuss.


Why Twitter won

I noted in a previous post the missing feature of consumer-side filtering in networks like Facebook and Google Plus. Twitter of course, has the same problem. I might follow hundreds of people, and all of their tweets are merged into a single timeline, with no rate-limiting or filtering of any kind.


Is network I/O always an effect worth tracking?

One of the most important contributions of FP is the discipline that effects which affect program meaning should be treated as values and explicitly sequenced. Following this discipline leads to an architecture which splits programs into two phases–in the first phase, first-class effects are built up and combined using pure functions, and in the second phase (the ‘end of the universe’), these effects are interpreted in order to actually do something.


Alternatives to GADTs in Scala

Scala’s support for GADTs, really any existential types in pattern matching, has been poor for a while. I’ve talked about this before and submitted a few bug reports, but at this point I’m not holding my breath that we’ll be getting good support for these things in the near future. Instead, I’ve been focusing my attention on finding workarounds.