[GHC] #16031: Show instance for Data.Fixed does not show parentheses for negatives

GHC ghc-devs at haskell.org
Tue Dec 11 19:41:59 UTC 2018


#16031: Show instance for Data.Fixed does not show parentheses for negatives
-------------------------------------+-------------------------------------
        Reporter:  skeuchel          |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  libraries/base    |              Version:  8.7
      Resolution:                    |             Keywords:  Data.Fixed,
                                     |  Show, newcomer
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect result  |  Unknown/Multiple
  at runtime                         |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by RyanGlScott):

 * keywords:  Data.Fixed, Show => Data.Fixed, Show, newcomer


Comment:

 Good catch. I wouldn't expect this to be difficult to fix—we'd just need
 to change the `Show` instance such that negative `Fixed` values are
 parenthesized with a sufficiently high precedence value. For inspiration,
 one can look at the existing
 [http://git.haskell.org/ghc.git/blob/4b3022021d49778bcd29a57308dbe0a076549f1b:/libraries/base/GHC/Show.hs#l472
 Show Integer instance], which parenthesizes negative `Integer`s when the
 precedence is higher than 6.

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


More information about the ghc-tickets mailing list