(don't know if others are/have attended to this) Hi,
thanks, I've committed the obvious fix for this one. As for you other question, GHC's Outputable is one example of a Pretty use which lets you prune documents at a certain depth. The sources can be found in ghc/compiler/utils/Outputable.lhs - maybe something in there that's of use to you.. hth --sigbjorn ----- Original Message ----- From: "Johannes Waldmann" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, November 06, 2001 13:40 Subject: Pretty.lhs: bug found, feature missed > We were recently bitten by what seems to be > a bug in hslibs/text/Pretty.lhs. > The following code prints an infinite string: > > > import Pretty > > 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 > > > I think this is due to the function indent/spaces > called with a negative argument. The following is in Pretty.lhs: > > > indent n | n >= 8 = '\t' : indent (n - 8) > | otherwise = spaces n > > spaces 0 = "" > spaces n = ' ' : spaces (n - 1) > > > This looks Really Dangerous. > > > > Another point: we would want to use a version of `render (d :: Doc)' > that always produces only a bounded amount of output, > by cutting off sub-documents that are too deeply nested. > (Some LISP pretty printers do have this feature - > they cut long lists, and deeply nested lists). > Before sitting down and trying to implement this, we would like to > check whether someone already did it. If so, please tell us. > > > Best regards, > -- > -- Johannes Waldmann ---- http://www.informatik.uni-leipzig.de/~joe/ -- > -- [EMAIL PROTECTED] -- phone/fax (+49) 341 9732 204/252 -- > > _______________________________________________ > Glasgow-haskell-users mailing list > [EMAIL PROTECTED] > http://www.haskell.org/mailman/listinfo/glasgow-haskell-users _______________________________________________ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
