Functional programming, UX, tech
Twitter • GitHub • LinkedIn • RSS
My book, Functional Programming in Scala, uses Scala as a vehicle for teaching FP. Read what people are saying about it.
Unison: a friendly programming language from the future
unison.cloud: the worldwide elastic computer (coming soon)
Type systems and UX: an example
CSS is unnecessary
CSS, a language for specifying visual appearance on the web, is … so complex that it has never been implemented correctly; yet, successive versions specify even more complexity. At the same time, it is so underpowered that many elementary graphic designs are impossible or prohibitively difficult, and context-sensitivity (or anything computational) must be addressed externally. Most CSS lore is dedicated to describing the tangles of brittle hacks needed to circumvent incompatibilities or approximate a desired appearance.
Here is a question: why should knowledge of my address grant anyone in the world (inlcuding both L.L. Bean and Unabombers) the capability to cause a physical artifact to be delivered to my place of residence? Moreover, anyone with knowledge of my address retains this capability until the end of time, at least until I move! If we were designing a physical delivery network from scratch today, in the age of software, is this really how we’d choose to set things up? Clearly not! Here is a proposal:
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.
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.
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.