#1920: Show instance for Ratio is wrong
----------------------------+-----------------------------------------------
 Reporter:  guest           |          Owner:  simonmar  
     Type:  bug             |         Status:  new       
 Priority:  normal          |      Milestone:  6.8 branch
Component:  libraries/base  |        Version:  6.6.1     
 Severity:  normal          |     Resolution:            
 Keywords:                  |     Difficulty:  Unknown   
 Testcase:                  |   Architecture:  Unknown   
       Os:  Unknown         |  
----------------------------+-----------------------------------------------
Old description:

> 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.

New description:

 {{{
 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#comment:13>
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