[GHC] #12970: Add default implementation for Bits.bitSize

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

[GHC] #12970: Add default implementation for Bits.bitSize

GHC - devs mailing list
#12970: Add default implementation for Bits.bitSize
-------------------------------------+-------------------------------------
           Reporter:  txnull         |             Owner:
               Type:  feature        |            Status:  new
  request                            |
           Priority:  normal         |         Milestone:
          Component:                 |           Version:
  libraries/base                     |
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 I think it would be a good idea to provide a default implementation for
 bitSize, example:

 {{{#!hs
   bitSize b = fromMaybe (error "bitSize is undefined") (bitSizeMaybe b)
 }}}

 The advantage is that from now on new instances of Bits no longer need to
 define bitSize.

 And once bitSize has been removed there will be no errors about it not
 being a method of class Bits.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12970>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #12970: Add default implementation for Bits.bitSize

GHC - devs mailing list
#12970: Add default implementation for Bits.bitSize
-------------------------------------+-------------------------------------
        Reporter:  txnull            |                Owner:
            Type:  feature request   |               Status:  upstream
        Priority:  normal            |            Milestone:
       Component:  libraries/base    |              Version:
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by bgamari):

 * cc: core-libraries-committee@… (added)
 * status:  new => upstream


Comment:

 This would need to be cleared with the
 [[https://wiki.haskell.org/Core_Libraries_Committee|Core Libraries
 Committee]].

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12970#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #12970: Add default implementation for Bits.bitSize

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#12970: Add default implementation for Bits.bitSize
-------------------------------------+-------------------------------------
        Reporter:  txnull            |                Owner:
            Type:  feature request   |               Status:  upstream
        Priority:  normal            |            Milestone:
       Component:  libraries/base    |              Version:
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by hvr):

 it may make sense to also consider a DefaultSignature-based default impl
 for `bitSizeMaybe` inheriting from `FiniteBits(finiteBitSize)`

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12970#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #12970: Add default implementation for Bits.bitSize

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#12970: Add default implementation for Bits.bitSize
-------------------------------------+-------------------------------------
        Reporter:  txnull            |                Owner:  (none)
            Type:  feature request   |               Status:  upstream
        Priority:  normal            |            Milestone:
       Component:  libraries/base    |              Version:
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by txnull):

 Any news on the issue?

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12970#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #12970: Add default implementation for Bits.bitSize

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#12970: Add default implementation for Bits.bitSize
-------------------------------------+-------------------------------------
        Reporter:  txnull            |                Owner:  (none)
            Type:  feature request   |               Status:  upstream
        Priority:  normal            |            Milestone:
       Component:  libraries/base    |              Version:
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by ekmett):

 We deprecated bitSize back in 7.8. Removing it outright in 8.4 seems to be
 a reasonably measured move and would preempt the need for this default.
 I'm rather inclined to say we should just finish removing it.

 Either way, we're now past the window in which we should do anyhing either
 way that would affect 8.2.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12970#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #12970: Add default implementation for Bits.bitSize

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#12970: Add default implementation for Bits.bitSize
-------------------------------------+-------------------------------------
        Reporter:  txnull            |                Owner:  (none)
            Type:  feature request   |               Status:  upstream
        Priority:  high              |            Milestone:  8.4.1
       Component:  libraries/base    |              Version:
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by bgamari):

 * priority:  normal => high
 * milestone:   => 8.4.1


Comment:

 Sounds good to me, let's remove it for 8.4.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12970#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #12970: Add default implementation for Bits.bitSize

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#12970: Add default implementation for Bits.bitSize
-------------------------------------+-------------------------------------
        Reporter:  txnull            |                Owner:  dfeuer
            Type:  feature request   |               Status:  upstream
        Priority:  high              |            Milestone:  8.4.1
       Component:  libraries/base    |              Version:
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by dfeuer):

 * owner:  (none) => dfeuer


--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12970#comment:6>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #12970: Add default implementation for Bits.bitSize

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#12970: Add default implementation for Bits.bitSize
-------------------------------------+-------------------------------------
        Reporter:  txnull            |                Owner:  dfeuer
            Type:  feature request   |               Status:  patch
        Priority:  high              |            Milestone:  8.4.1
       Component:  libraries/base    |              Version:
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D3723
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by dfeuer):

 * status:  upstream => patch
 * differential:   => Phab:D3723


Comment:

 I've submitted Phab:D3723 to remove `bitSize`. My only question is whether
 we should add it back as a function

 {{{#!hs
 bitSize :: FiniteBitSize a => a -> Int
 bitSize = finiteBitSize
 }}}

 to reduce unnecessary breakage. This only goes so far; module import lines
 may need to be changed to fix old code.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12970#comment:7>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #12970: Add default implementation for Bits.bitSize

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#12970: Add default implementation for Bits.bitSize
-------------------------------------+-------------------------------------
        Reporter:  txnull            |                Owner:  dfeuer
            Type:  feature request   |               Status:  patch
        Priority:  high              |            Milestone:  8.4.1
       Component:  libraries/base    |              Version:
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D3723
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by hvr):

 Replying to [comment:7 dfeuer]:
 > I've submitted Phab:D3723 to remove `bitSize`. My only question is
 whether we should add it back as a function

 to be fair, bitSize was deprecated 3 years ago in GHC 7.8; and when GHC
 8.4 is released that'll be 4 years. If the point of a deprecation is to
 eventually rid the API of the deprecated entity, 4 years (or a 4 rls
 window) is IMO more than enough time for everyone to adapt... ;-)

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12970#comment:8>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #12970: Add default implementation for Bits.bitSize

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#12970: Add default implementation for Bits.bitSize
-------------------------------------+-------------------------------------
        Reporter:  txnull            |                Owner:  dfeuer
            Type:  feature request   |               Status:  patch
        Priority:  high              |            Milestone:  8.4.1
       Component:  libraries/base    |              Version:
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D3723
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by dfeuer):

 Replying to [comment:8 hvr]:
 > Replying to [comment:7 dfeuer]:
 > > I've submitted Phab:D3723 to remove `bitSize`. My only question is
 whether we should add it back as a function
 >
 > to be fair, bitSize was deprecated 3 years ago in GHC 7.8; and when GHC
 8.4 is released that'll be 4 years. If the point of a deprecation is to
 eventually rid the API of the deprecated entity, 4 years (or a 4 rls
 window) is IMO more than enough time for everyone to adapt... ;-)

 For sure. It's a bit sad, though, that we're discarding a perfectly good
 name simply because it was originally stuck in the wrong class. I guess
 that's life.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12970#comment:9>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #12970: Add default implementation for Bits.bitSize

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#12970: Add default implementation for Bits.bitSize
-------------------------------------+-------------------------------------
        Reporter:  txnull            |                Owner:  dfeuer
            Type:  feature request   |               Status:  patch
        Priority:  high              |            Milestone:  8.4.1
       Component:  libraries/base    |              Version:
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D3723
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by hvr):

 > For sure. It's a bit sad, though, that we're discarding a perfectly good
 name simply because it was originally stuck in the wrong class. I guess
 that's life.

 Oh, now that I read the type-sig more carefully, I see it changes from
 `BitSize a =>` to `FiniteBitSize a =>`; which makes me more neutral on
 this. I guess it's a sensible thing to do; the only downside is that we
 carry around redundancy (e.g. an alias for `finiteBiteSize`).

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12970#comment:10>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #12970: Add default implementation for Bits.bitSize

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#12970: Add default implementation for Bits.bitSize
-------------------------------------+-------------------------------------
        Reporter:  txnull            |                Owner:  dfeuer
            Type:  feature request   |               Status:  patch
        Priority:  high              |            Milestone:  8.4.1
       Component:  libraries/base    |              Version:
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D3723
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by bgamari):

 Are we going to do this? If so I wonder whether we should push it to 8.6
 to avoid breaking libraries again prior to 8.4.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12970#comment:11>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #12970: Add default implementation for Bits.bitSize

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#12970: Add default implementation for Bits.bitSize
-------------------------------------+-------------------------------------
        Reporter:  txnull            |                Owner:  dfeuer
            Type:  feature request   |               Status:  patch
        Priority:  high              |            Milestone:  8.4.1
       Component:  libraries/base    |              Version:
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D3723
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by hvr):

 Replying to [comment:11 bgamari]:
 > Are we going to do this? If so I wonder whether we should push it to 8.6
 to avoid breaking libraries again prior to 8.4.

 By that argument we'd never remove anything, as the same situation would
 just re-present itself during GHC 8.5; if maintainers have been ignoring
 the warnings introduced in GHC 7.8, they'll likely ignore them forever...
 life's too short... ;-)

 In comment:4 Ed wrote:

 > We deprecated `bitSize` back in 7.8. Removing it outright in 8.4 seems
 to be a reasonably measured move and would preempt the need for this
 default. I'm rather inclined to say we should just finish removing it.

 So that's the part I believe everyone agrees.

 And one year later, David submitted a patch (see comment:7) to finally
 finish this.

 However, David also brought up a suggestion of doing something that wasn't
 originally considered/planned: adding a top-level `bitSize` binding in
 place of the removed `bitSize` method.  It isn't clear whether this is
 something everyone agrees to want to do (David writes in phab:D3723:
 ''"@ekmett seems to oppose stealing the name."'').


 What I'd suggest at this point while we're still ahead of the GHC 8.4
 freeze: Do the removal now, don't add anything new in its place. Once GHC
 HEAD snapshots appear with this change, we'll see quickly how bad the
 fallout is.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12970#comment:12>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|

Re: [GHC] #12970: Add default implementation for Bits.bitSize

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#12970: Add default implementation for Bits.bitSize
-------------------------------------+-------------------------------------
        Reporter:  txnull            |                Owner:  dfeuer
            Type:  feature request   |               Status:  patch
        Priority:  high              |            Milestone:  8.4.1
       Component:  libraries/base    |              Version:
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D3723
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by bgamari):

 > By that argument we'd never remove anything, as the same situation would
 just re-present itself during GHC 8.5; if maintainers have been ignoring
 the warnings introduced in GHC 7.8, they'll likely ignore them forever...
 life's too short... ;-)

 Fair enough.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12970#comment:13>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets