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
1
u/gb__ Aug 10 '16
Yeah, that's definitely an ugly consequence of this approach - in the example above it's not too hard for a human to figure out that the missing cases won't occur, but it could be much harder in a less contrived case.
And thanks for the injectivity example - I did remember that from the paper, I more meant that I couldn't think of a good example of it in a somewhat concrete but easy to show example. A lack of imagination on my part no doubt.
I would love to have real GADTs in PureScript (it would help with the situation for handling existentials also), but for now this is still a potentially useful technique when the basic equality is all you need. I liked this application of Leibniz too, as I found it helpful to get my head around how it might actually be used in practice.