Proposal: remove datatype contexts from base
The Haskell' committee decided to remove datatype contexts from the language: http://www.haskell.org/pipermail/haskell-prime/2011-January/003335.html (though this doesn't seem to be in the Report yet.) In the base package there are 4 of these: Data/Complex.hs:data (RealFloat a) => Complex a GHC/Arr.lhs:data Ix i => Array i e GHC/Real.lhs:data (Integral a) => Ratio a = !a :% !a deriving (Eq) Control/Arrow.hs:newtype ArrowApply a => ArrowMonad a b = ArrowMonad (a () b) As far as I know, removing them won't break any code that compiles now, so let's do it.
On Tue, May 24, 2011 at 4:08 PM, Ross Paterson
The Haskell' committee decided to remove datatype contexts from the language:
http://www.haskell.org/pipermail/haskell-prime/2011-January/003335.html
(though this doesn't seem to be in the Report yet.)
In the base package there are 4 of these:
Data/Complex.hs:data (RealFloat a) => Complex a GHC/Arr.lhs:data Ix i => Array i e GHC/Real.lhs:data (Integral a) => Ratio a = !a :% !a deriving (Eq) Control/Arrow.hs:newtype ArrowApply a => ArrowMonad a b = ArrowMonad (a () b)
As far as I know, removing them won't break any code that compiles now, so let's do it.
+1
+1 Excerpts from Ross Paterson's message of Tue May 24 10:08:14 -0400 2011:
The Haskell' committee decided to remove datatype contexts from the language:
http://www.haskell.org/pipermail/haskell-prime/2011-January/003335.html
(though this doesn't seem to be in the Report yet.)
In the base package there are 4 of these:
Data/Complex.hs:data (RealFloat a) => Complex a GHC/Arr.lhs:data Ix i => Array i e GHC/Real.lhs:data (Integral a) => Ratio a = !a :% !a deriving (Eq) Control/Arrow.hs:newtype ArrowApply a => ArrowMonad a b = ArrowMonad (a () b)
As far as I know, removing them won't break any code that compiles now, so let's do it.
On Tuesday 24 May 2011 16:08:14, Ross Paterson wrote:
The Haskell' committee decided to remove datatype contexts from the language:
http://www.haskell.org/pipermail/haskell-prime/2011-January/003335.html
+1
+1
On Tue, May 24, 2011 at 4:08 PM, Ross Paterson
The Haskell' committee decided to remove datatype contexts from the language:
http://www.haskell.org/pipermail/haskell-prime/2011-January/003335.html
(though this doesn't seem to be in the Report yet.)
In the base package there are 4 of these:
Data/Complex.hs:data (RealFloat a) => Complex a GHC/Arr.lhs:data Ix i => Array i e GHC/Real.lhs:data (Integral a) => Ratio a = !a :% !a deriving (Eq) Control/Arrow.hs:newtype ArrowApply a => ArrowMonad a b = ArrowMonad (a () b)
As far as I know, removing them won't break any code that compiles now, so let's do it.
_______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries
On Tue, May 24, 2011 at 03:08:14PM +0100, Ross Paterson wrote:
The Haskell' committee decided to remove datatype contexts from the language:
http://www.haskell.org/pipermail/haskell-prime/2011-January/003335.html
(though this doesn't seem to be in the Report yet.)
In the base package there are 4 of these:
Data/Complex.hs:data (RealFloat a) => Complex a GHC/Arr.lhs:data Ix i => Array i e GHC/Real.lhs:data (Integral a) => Ratio a = !a :% !a deriving (Eq) Control/Arrow.hs:newtype ArrowApply a => ArrowMonad a b = ArrowMonad (a () b)
As far as I know, removing them won't break any code that compiles now, so let's do it.
Done! I was going to make legacy copies in the haskell98 package with the datatype contexts, but copying the Array type would mean copying lots of unpleasant GHC code, and copying the Complex and Ratio types would mean also going through and copying lots of instances, so I wimped out and did nothing. So technically the haskell98 modules don't export precisely the right types any more. Thanks Ian
I'd love to do this, but it'd mean that GHC wouldn't conform to Haskell 98 unless we shipped two versions of the libraries, which seems overkill. Do you think that's acceptable? I think it probably is. We can just record it as a shortcoming of GHC, but it's one that no one will care about. Simon | -----Original Message----- | From: libraries-bounces@haskell.org [mailto:libraries-bounces@haskell.org] On Behalf | Of Ross Paterson | Sent: 24 May 2011 15:08 | To: libraries@haskell.org | Subject: Proposal: remove datatype contexts from base | | The Haskell' committee decided to remove datatype contexts from the language: | | http://www.haskell.org/pipermail/haskell-prime/2011-January/003335.html | | (though this doesn't seem to be in the Report yet.) | | In the base package there are 4 of these: | | Data/Complex.hs:data (RealFloat a) => Complex a | GHC/Arr.lhs:data Ix i => Array i e | GHC/Real.lhs:data (Integral a) => Ratio a = !a :% !a deriving (Eq) | Control/Arrow.hs:newtype ArrowApply a => ArrowMonad a b = ArrowMonad (a () b) | | As far as I know, removing them won't break any code that compiles now, | so let's do it. | | _______________________________________________ | Libraries mailing list | Libraries@haskell.org | http://www.haskell.org/mailman/listinfo/libraries
On Wed, May 25, 2011 at 3:30 AM, Simon Peyton-Jones
I'd love to do this, but it'd mean that GHC wouldn't conform to Haskell 98 unless we shipped two versions of the libraries, which seems overkill.
Do you think that's acceptable? I think it probably is. We can just record it as a shortcoming of GHC, but it's one that no one will care about.
Simon
+1 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. ;) -Edward
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
participants (11)
-
Bas van Dijk -
Daniel Fischer -
dm-list-haskell-libraries@scs.stanford.edu -
Edward Kmett -
Edward Z. Yang -
Favonia -
Ian Lynagh -
Johan Tibell -
Ross Paterson -
Sebastian Fischer -
Simon Peyton-Jones