r/purescript • u/gb__ • Aug 10 '16
Approximating GADTs in PureScript
http://code.slipthrough.net/2016/08/10/approximating-gadts-in-purescript/
20
Upvotes
r/purescript • u/gb__ • Aug 10 '16
View all comments
Show parent comment
2
u/gasche Aug 10 '16
Well my point would be that while GADTs type checking guarantees that only the first two cases occur, you on the other hand have to write dummy failure cases that you think will not be reached by execution, with no static guarantees.
The issues with injectivity, which are discussed in the original paper by Sulzmann and Wang, are equally delicate: from
(t1, t2) ~ (u1, u2)you should be able to deducet1 ~ u1andt2 ~ u2, and while that is possible with the less-efficient coercion functions, it seems hard to do with Leibniz equality alone -- well in absence of type families at least.