[ghc-steering-committee] #380 GHC2021: A plea for GADTs

Spiwack, Arnaud arnaud.spiwack at tweag.io
Tue Dec 8 08:15:09 UTC 2020

On Fri, Dec 4, 2020 at 5:03 PM Iavor Diatchki <iavor.diatchki at gmail.com>

> I don't want GADTs to on by default, because pattern matching on them does
> not work the same as with normal data types (i.e., you often need to have
> an explicitly type signature, or be aware of GHC type checking algorithm to
> know when a type signature is not needed).  So I'd like to be able to see
> explicitly that GADTs might be in play.

For what it's worth, you can pattern-match on GADTs with GADTs off (but
then you need TypeFamilies on, which still seems to be on its way to
GHC2021 (though see Richard's “a few more pleas”)).

> :set -XGADTs
> data T a where { MkT :: T Int }
> :set -XNoGADTs
> :set -XTypeFamilies
> f :: T a -> a; f MkT = 0

I really see very little reason to not add GADTs (except MonoLocalBind,
maybe, see Richard's email again, but it applies to TypeFamilies too).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-steering-committee/attachments/20201208/e1db0de8/attachment.html>

More information about the ghc-steering-committee mailing list