[Haskell-cafe] Constraints on data-types, mis-feature?

Jonathan Cast jcast at ou.edu
Wed Jul 11 15:40:08 EDT 2007


On Tuesday 10 July 2007, Jim Apple wrote:
> On 7/9/07, Jonathan Cast <jcast at ou.edu> wrote:
> > GADTs don't change anything (at least, not the last time I checked).
>
> GHC (in HEAD, at least) eliminates this wart for any datatype declared
> with GADT syntax.
>
> http://www.haskell.org/ghc/dist/current/docs/users_guide/data-type-extensio
>ns.html#gadt-style
>
> "Any data type that can be declared in standard Haskell-98 syntax can
> also be declared using GADT-style syntax. The choice is largely
> stylistic, but GADT-style declarations differ in one important
> respect: they treat class constraints on the data constructors
> differently. Specifically, if the constructor is given a type-class
> context, that context is made available by pattern matching."

Cool!  Looks like it does work in HEAD (although it does /not/ in 6.6.1).

Jonathan Cast
http://sourceforge.net/projects/fid-core
http://sourceforge.net/projects/fid-emacs


More information about the Haskell-Cafe mailing list