Proposal: remove datatype contexts from base

dm-list-haskell-libraries at scs.stanford.edu dm-list-haskell-libraries at scs.stanford.edu
Sun May 29 21:38:56 CEST 2011


At Thu, 26 May 2011 08:32:41 -0400,
Edward Kmett wrote:
> 
> While we wouldn't comply with Haskell 98, the only difference would be that
> slightly more code could type check and a number of instances for things like
> Complex can be written that couldn't before. How terrible. ;)

This is probably true, but not 100% guaranteed without looking at each
individual case.  It is possible to have code that behaves differently
when you remove the data type contexts.  Consider the following
example from http://hackage.haskell.org/trac/haskell-prime/wiki/NoDatatypeContexts

	data Floating a => Foo a = Constr a
	getIncVal (Constr x) = x + 1
	foo = show (getIncVal (Constr 1)) -- foo is "2.0"

	data Foo a = Constr a
	getIncVal (Constr x) = x + 1
	foo = show (getIncVal (Constr 1)) -- foo is "2"

I'm in favor of getting rid of the contexts, just pointing out that
it's not quite as simple as saying that no existing valid code can be
affected.

David



More information about the Libraries mailing list