#1062: Bad output from Text.PrettyPrint.HughesPJ
-------------------------------+--------------------------------------------
    Reporter:  igloo           |       Owner:         
        Type:  bug             |      Status:  new    
    Priority:  normal          |   Milestone:  _|_    
   Component:  libraries/base  |     Version:  6.6    
    Severity:  normal          |    Keywords:         
  Difficulty:  Unknown         |    Testcase:  pp1    
Architecture:  Unknown         |          Os:  Unknown
-------------------------------+--------------------------------------------
This program:

 {{{
 import Text.PrettyPrint.HughesPJ

 ncat x y = nest 4 $ cat [ x, y ]

 d1 = foldl1 ncat $ take 50 $ repeat $ char 'a'
 d2 = parens $  sep [ d1, text "+" , d1 ]

 main = print d2
 }}}

 generates the output below. I haven't worked out what is expected, but
 this certainly doesn't look right to me (in particular, the space before
 the `a` on the third line of the output).

 {{{
 % runghc pp1.hs | tr ' ' _
 (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
+___________________________________________________________________________________________________________________________________________________________________________________________________a
 _a
 a
 a
 a
 a
 a
 a
 a
 a
 a
 a
 a
 a
 a
 a
 a
 a
 a
 a
 a
 a
 a
 a
 a
 a
 a
 a
 a
 a
 a
 a
 a
 a
 a
 a
 a
 a
 a
 a
 a
 a
 a
 a
 a
 a
 a
 a
 a
 a)
 }}}

 The bug report goes on to say:

 {{{
 This code used to print an infinite string, by calling 'spaces'
 with a negative argument.  There's a patch in the library now,
 which makes 'spaces' do somehthing sensible when called with a negative
 argument, but it really should not happen at all.

 This output is not what is expected, becuase the
 test "works" now, by virtue of a hack in HughesPJ.spaces.
 I'm leaving this strange output here to remind us to look
 at the root cause of the problem.  Sometime.
 }}}

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

Reply via email to