#1920: Show instance for Ratio is wrong
----------------------------+-----------------------------------------------
 Reporter:  guest           |          Owner:         
     Type:  bug             |         Status:  new    
 Priority:  normal          |      Milestone:         
Component:  libraries/base  |        Version:  6.6.1  
 Severity:  normal          |       Keywords:         
 Testcase:                  |   Architecture:  Unknown
       Os:  Unknown         |  
----------------------------+-----------------------------------------------
 GHCi> :m Data.Ratio
 GHCi> show (1%2)
 "1%2"

 Hugs> :l Data.Ratio
 Hugs> show (1%2)
 "1 % 2"

 The Haskell report specifies (http://haskell.org/onlinereport/ratio.html):

 instance  (Integral a)  => Show (Ratio a)  where
     showsPrec p (x:%y)  =  showParen (p > ratPrec)
                                (showsPrec (ratPrec+1) x .
                                 showString " % " .
                                 showsPrec (ratPrec+1) y)

 This effects the nofib suite, where the expected.stdout files are based on
 GHC's incorrect Ratio implementation.

 Tested only on 6.6.1.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1920>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to