#1337: Fix wrong indentation from Text.PrettyPrint.HughesPJ fill (fcat and fsep)
------------------------------+---------------------------------------------
 Reporter:  thorkilnaur       |          Owner:  thorkilnaur
     Type:  bug               |         Status:  new        
 Priority:  normal            |      Milestone:  6.10 branch
Component:  libraries/pretty  |        Version:  6.6.1      
 Severity:  normal            |     Resolution:             
 Keywords:                    |     Difficulty:  Unknown    
 Testcase:  Pp003             |   Architecture:  Unknown    
       Os:  Unknown           |  
------------------------------+---------------------------------------------
Comment (by benedikt):

 Thorkil's patch seems to be correct.

 The patch bundle in #2393 achieves the same effect, namely eliding nests
 in the p2 argument of the left layout of fill:
 {{{
 fillIndent k (p1:p2:ps) =
     oneLiner p1 <g> fillIndent (k + length p1 + length g) (elide_nests
 (oneLiner p2) : ps)
      `Union`
    (p1 $*$ nest (-k) (fillIndent 0 ps))
 }}}

 The Bug1176a.hs attachment is yet another demonstration of the problem.

 As thorkil noted above, a correct implementation shouldn't use (fsep .
 punctuate comma $ xs) if some elements of xs are such, that their first
 lines aren't leftmost in all layouts - this is a user error.

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