3 ms·
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 retur
by siraben 5y ago
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.
- bradrn 5y agoYou 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.