[Haskell-cafe] Type Constraints on Data Constructors

Malcolm Wallace malcolm.wallace at me.com
Wed Jun 8 21:15:41 CEST 2011

> data Bar f a = Foo f => Bar {bar :: f a}

The class context on the data constructor buys you nothing extra in terms of expressivity in the language.  All it does is force you to repeat the context on every function that uses the datatype.  For this reason, the language committee has decided that the feature will be removed in the next revision of Haskell.


More information about the Haskell-Cafe mailing list