GADTSyntax extension allows you to write data declarations so that the types of the constructors are made more obvious. This is a great reminder while you’re learning.
The name “GADT syntax” comes from the fact that it was introduced for the purpose of defining GADTs, but you don’t need to worry about what GADTs are to use the syntax.
Here is the standard definition of
A constructor has a type, just like any other value in Haskell. We can see this in the REPL using the
λ> :type Nothing Nothing :: Maybe a λ> :type Just Just :: a -> Maybe a
With GADT syntax, we define a type by explicitly writing the type signature for each of its constructors.
This definition of
Maybe has exactly the same meaning as the one above.