8
votes

One can use GADT to express Existentially quantified types.

I see that GADT is more generic - data-type-extensions, paragraph section 7.4.7

When it's better to use Existentially quantified types then GADT? Are there any drawbacks using GADT compared to Existentially quantified types?

2

2 Answers

11
votes

GADTs came along later than existentials, and they generalise them. I'm not aware of any drawbacks and would always use GADT syntax in new code as it's much clearer.

The documentation confirms this:

Notice that GADT-style syntax generalises existential types.

2
votes

If you use the newest version of GHC, then there are no drawbacks I'm aware of. But in older versions you could combine GADTs and GeneralizedNewtypeDeriving in a type-unsafe way. I don't think the same was possible with ExistentialQuantification.