Get the latest tech news
Making my life easier with GADTs
In which I showcase one concrete example where dependent types allow me to turn the handling of different but similar compiler targets into a breeze of fresh air.
In which I showcase one concrete example where dependent types — and more precisely, Generalized Algebraic Datatypes (GADTs) — allow me to turn the handling of different but similar compiler targets into a breeze of fresh air. So a function in the environment stores its expression body — a LamBox.Term — and a datatype declaration tells which constructors come with it, and their respective number of arguments. I’m not breaking new grounds here, but I feel like the world is missing short and sweet practical examples in which sprinkles of dependent types help you avoid mistakes — for free!
Or read this on Hacker News