Get the latest tech news
Why GADTs matter for performance (2015)
When GADTs (Generalized Algebraic DataTypes) landed inOCaml, I wasn’t particularly happy about it. I assumed that it was the kind ofnonsense you get when you...
Which is to say that the standard GADT examples all seem to be about the kinds of things that compiler writers do, like embed domain-specific languages or build typed abstract-syntax trees. But it’s a completely different type, and so building a general purpose data structure that uses bytes when it would make sense, and ordinary arrays otherwise, is a little awkward. GADTs are about more than clever typed interpreters; they’re a powerful mechanism for building easy to use abstractions that give you more precise control of your memory representation.
Or read this on Hacker News