#669: negative indentation in  Text.PrettyPrint.HughesPJ
------------------------------------------+---------------------------------
 Reporter:  [EMAIL PROTECTED]  |          Owner:  thorkilnaur
     Type:  bug                           |         Status:  new        
 Priority:  normal                        |      Milestone:  6.10 branch
Component:  libraries/pretty              |        Version:  6.4.1      
 Severity:  minor                         |     Resolution:             
 Keywords:                                |     Difficulty:  Unknown    
 Testcase:  pp1                           |   Architecture:  Unknown    
       Os:  Unknown                       |  
------------------------------------------+---------------------------------
Comment (by benedikt):

 Thanks thorkil

 I'll document another example using $$ (not present in the paper), which
 might be reported as a bug.
 The negative indentation causes what I would call
 "surprising behavior from the client's point of view".
 {{{
 show$ text "a" <> (nest 4 (text "b") $+$ text "c")) $$ text "d" ==>
 |ab|
 |c..d|

 (text "a" <> (nest 4 (text "b") $+$ text "c")) $$ text "d" =
 l1:   ....|ab...|
 l2:   .c..|.....|
               `overlap`
 l3:   ....|d.....|
   ==
 l1:   ....|ab...|
 l2:   .c..|d....|
 }}}

 The library behaves in a consistent way, but the client is probably
 surprised that
 (a $$ text "d") puts `d' in column 4.

 The cleanest solution would be to make negative indentation a hard error -
 but
 this might break existing code, so I won't suggest it (maybe emit a
 warning ?)

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/669#comment:15>
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