Quantcast

Proposal: remove datatype contexts from base

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Proposal: remove datatype contexts from base

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
[hidden email]
http://www.haskell.org/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Proposal: remove datatype contexts from base

Johan Tibell-2
On Tue, May 24, 2011 at 4:08 PM, Ross Paterson <[hidden email]> 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.

+1

_______________________________________________
Libraries mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Proposal: remove datatype contexts from base

Edward Z. Yang
In reply to this post by Ross Paterson
+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.
>

_______________________________________________
Libraries mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Proposal: remove datatype contexts from base

Daniel Fischer
In reply to this post by Ross Paterson
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

_______________________________________________
Libraries mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Proposal: remove datatype contexts from base

Sebastian Fischer-2
In reply to this post by Ross Paterson
+1

On Tue, May 24, 2011 at 4:08 PM, Ross Paterson <[hidden email]> 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.

_______________________________________________
Libraries mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/libraries


_______________________________________________
Libraries mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Proposal: remove datatype contexts from base

Favonia
+1

_______________________________________________
Libraries mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Proposal: remove datatype contexts from base

Bas van Dijk-2
In reply to this post by Ross Paterson
+1

_______________________________________________
Libraries mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Proposal: remove datatype contexts from base

Ian Lynagh
In reply to this post by Ross Paterson
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


_______________________________________________
Libraries mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: Proposal: remove datatype contexts from base

Simon Peyton Jones
In reply to this post by Ross Paterson
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: [hidden email] [mailto:[hidden email]] On Behalf
| Of Ross Paterson
| Sent: 24 May 2011 15:08
| To: [hidden email]
| 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
| [hidden email]
| http://www.haskell.org/mailman/listinfo/libraries


_______________________________________________
Libraries mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Proposal: remove datatype contexts from base

Edward Kmett
On Wed, May 25, 2011 at 3:30 AM, Simon Peyton-Jones <[hidden email]> wrote:
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

_______________________________________________
Libraries mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Proposal: remove datatype contexts from base

dm-list-haskell-libraries
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

_______________________________________________
Libraries mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/libraries
Loading...