[Haskell-cafe] data type declaration

Brandon S Allbery KF8NH allbery at ece.cmu.edu
Mon Jul 26 11:02:41 EDT 2010

Hash: SHA1

On 7/26/10 06:02 , John Lato wrote:
> If the behavior of class contexts on data types were changed to what
> you think it should mean, i.e. contexts specified in a data
> declaration are carried around for all uses of that type instead of
> just the data constructor, I wouldn't mind at all.  Whether this is a
> good idea or would cause other problems, I can't say.

As I understand it:
1) carrying them around complicates Haskell98 (and now Haskell2010)
compatibility (also see below);
2) GADTs do what you want, since they don't have backward compatibility baggage.

As to the current proposal, I think nobody's certain what would happen to
older programs if data were changed to carry contexts around --- someone
might be relying on the current behavior, and changing it might produce
runtime oddness instead of a compile-time error --- whereas making contexts
illegal will produce an easily-fixed error message in all relevant cases.

- -- 
brandon s. allbery     [linux,solaris,freebsd,perl]      allbery at kf8nh.com
system administrator  [openafs,heimdal,too many hats]  allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university      KF8NH
Version: GnuPG v2.0.10 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/


More information about the Haskell-Cafe mailing list