News for hackers. Stuff that matters.
Re:GADTs for Dummies by siraben on Wednesday May 19, 2021 @03:12AM (#27205533)
One thing that I'd like to add is that using the typed GADT encoding of the AST lets you write a total eval function such as eval :: AST r → r, no need to return a Maybe or Either! In the case without GADTs you couldn't return a boolean in one case and an Int in another. Here you can.
Re:GADTs for Dummies by bradrn on Wednesday May 19, 2021 @08:55AM (#27207901)
You know, I did very nearly mention this, but decided not to in the end. You are of course entirely right, and this is indeed a major reason why I use GADTs myself.