It is deprecated because it was a mistake, and in fact there was no useful functionality! All that was done was associated with many additional restrictions elsewhere. In particular, when matching patterns for this type, you would have to add a constraint, and not (as you might hope) gain access to the context, based on the knowledge that it was necessary to build the value in the first place.
A โreplacement,โ which actually works differently and tracks known contexts for you, is instead of using GADT style ads
data MyType a where ConstructorOne :: Ord a => a -> MyType a ConstructorTwo :: Ord a => a -> a -> MyType a
GADTs are generally more flexible in many other cases, but for this particular case, the creation of a value requires an Ord constraint, which is then carried along with the value and the pattern matching on the constructor pulls it back. This way, you donโt even need a context for functions using it, because you know that waiting for something like MyType a you will get an Ord a constraint with it.
CA McCann Sep 15 2018-11-11T00: 00Z
source share