I am sorry, I might have confused you. It appears that we have just a function for doing what you want; in UU.Pretty.Basic there is a function "invisible". From the manual page I quote:
invisible ppd

Makes the formatted element invisible (all its attributes are forgotten in order to always succeed, even if there is no space left!)

In exceptional cases we want to escape to the page width limit, for example when you want to generate additional tags for markup languages such as LaTeX or HTML:

> res_word rw = invisible (pp "{\\bf ") >|< rw >|< invisible (pp "}")
and try render (res_word "let") 3.



 Doaitse





On Dec 14, 2006, at 9:57 AM, Christian Maeder wrote:

Doaitse Swierstra schrieb:
The Prettyprint library you can download from:

http://www.cs.uu.nl/wiki/HUT/Download

I've looked into your module UU.Pretty.Basic starting with:

--  $Header: /data/cvs-rep/uust/lib/pretty/UU/Pretty/Basic.hs,v 1.2
2003/02/26 11:18:27 uust Exp $

And I did not find the type Doc that you describe below.

Christian

and is described on:

http://www.cs.uu.nl/wiki/HUT/PrettyPrintingCombinators

contains amongst others the following code:

data Doc        = Empty
| Char Char -- invariant: char is not '\n'
                | Text !Int String      -- invariant: text doesn't
contain '\n'
                | Line !Bool            -- True <=> when undone by
group, do not insert a space
                | Cat Doc Doc
                | Nest !Int Doc
                | Union Doc Doc         -- invariant: first lines of
first doc longer than the first lines of the second doc
                | Column  (Int -> Doc)
                | Nesting (Int -> Doc)

text ""         = Empty
text s          = Text (length s) s

so if you define now:

wrap l t r = Text 0 l <|> text t <|> Text 0 r

you should be set and done,

 Doaitse Swierstra


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to