definition: |
punctuate :: Doc -> [Doc] -> [Doc] punctuate d ds = go ds where go [] = [] go [x] = [x] go (x:xs@(_:_)) = (x <> d) : go xs |
demand: |
argument 2 |
deterministic: |
deterministic operation |
documentation: |
--- `(punctuate p xs)` concatenates all documents `xs` with document `p` except --- for the last document. --- --- someText = map text ["words","in","a","tuple"] --- test = parens (align (cat (punctuate comma someText))) --- --- This is layed out on a page width of 20 as: --- --- (words,in,a,tuple) --- --- But when the page width is 15, it is layed out as: --- --- (words, --- in, --- a, --- tuple) --- --- (If you want put the commas in front of their elements instead of at the --- end, you should use `tupled` or, in general, `encloseSep`.) --- @param p - a document as seperator --- @param xs - a list of documents --- @return concatenation of documents with p in between |
failfree: |
(_, _) |
indeterministic: |
referentially transparent operation |
infix: |
no fixity defined |
iotype: |
{(_,_) |-> {:,[]}} |
name: |
punctuate |
precedence: |
no precedence defined |
result-values: |
{:,[]} |
signature: |
Text.PrettyImpl.Doc -> [Text.PrettyImpl.Doc] -> [Text.PrettyImpl.Doc] |
solution-complete: |
operation might suspend on free variables |
terminating: |
yes |
totally-defined: |
possibly non-reducible on same data term |