-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | A prettyprinting library for laying out text documents.
--
-- doclayout is a prettyprinting library for laying out text documents,
-- with several features not present in prettyprinting libraries designed
-- for code. It was designed for use in pandoc.
@package doclayout
@version 0.4
-- | A prettyprinting library for the production of text documents,
-- including wrapped text, indentation and other prefixes, and blocks for
-- tables.
module Text.DocLayout
-- | Render a Doc. render (Just n) will use a line length
-- of n to reflow text on breakable spaces. render
-- Nothing will not reflow text.
render :: HasChars a => Maybe Int -> Doc a -> a
-- | A carriage return. Does nothing if we're at the beginning of a line;
-- otherwise inserts a newline.
cr :: Doc a
-- | Inserts a blank line unless one exists already. (blankline
-- <> blankline has the same effect as blankline.
blankline :: Doc a
-- | Inserts blank lines unless they exist already. (blanklines m
-- <> blanklines n has the same effect as blanklines (max
-- m n).
blanklines :: Int -> Doc a
-- | A breaking (reflowable) space.
space :: Doc a
-- | Create a Doc from a stringlike value.
literal :: HasChars a => a -> Doc a
-- | A literal string. (Like literal, but restricted to String.)
text :: HasChars a => String -> Doc a
-- | A character.
char :: HasChars a => Char -> Doc a
-- | Uses the specified string as a prefix for every line of the inside
-- document (except the first, if not at the beginning of the line).
prefixed :: IsString a => String -> Doc a -> Doc a
-- | Makes a Doc flush against the left margin.
flush :: Doc a -> Doc a
-- | Indents a Doc by the specified number of spaces.
nest :: IsString a => Int -> Doc a -> Doc a
-- | A hanging indent. hang ind start doc prints start,
-- then doc, leaving an indent of ind spaces on every
-- line but the first.
hang :: IsString a => Int -> Doc a -> Doc a -> Doc a
-- | beforeNonBlank d conditionally includes d unless it
-- is followed by blank space.
beforeNonBlank :: Doc a -> Doc a
-- | Makes a Doc non-reflowable.
nowrap :: IsString a => Doc a -> Doc a
-- | Content to print only if it comes at the beginning of a line, to be
-- used e.g. for escaping line-initial . in roff man.
afterBreak :: Text -> Doc a
-- | lblock n d is a block of width n characters, with
-- text derived from d and aligned to the left.
lblock :: HasChars a => Int -> Doc a -> Doc a
-- | Like lblock but aligned centered.
cblock :: HasChars a => Int -> Doc a -> Doc a
-- | Like lblock but aligned to the right.
rblock :: HasChars a => Int -> Doc a -> Doc a
-- | An expandable border that, when placed next to a box, expands to the
-- height of the box. Strings cycle through the list provided.
vfill :: HasChars a => a -> Doc a
-- | Removes leading blank lines from a Doc.
nestle :: Doc a -> Doc a
-- | Chomps trailing blank space off of a Doc.
chomp :: Doc a -> Doc a
-- | Encloses a Doc inside a start and end Doc.
inside :: Doc a -> Doc a -> Doc a -> Doc a
-- | Puts a Doc in curly braces.
braces :: HasChars a => Doc a -> Doc a
-- | Puts a Doc in square brackets.
brackets :: HasChars a => Doc a -> Doc a
-- | Puts a Doc in parentheses.
parens :: HasChars a => Doc a -> Doc a
-- | Wraps a Doc in single quotes.
quotes :: HasChars a => Doc a -> Doc a
-- | Wraps a Doc in double quotes.
doubleQuotes :: HasChars a => Doc a -> Doc a
-- | The empty document.
empty :: Doc a
-- | Concatenate a list of Docs, putting breakable spaces between
-- them.
(<+>) :: Doc a -> Doc a -> Doc a
infixr 6 <+>
-- | a $$ b puts a above b.
($$) :: Doc a -> Doc a -> Doc a
infixr 5 $$
-- | a $+$ b puts a above b, with a blank line
-- between.
($+$) :: Doc a -> Doc a -> Doc a
infixr 5 $+$
-- | Concatenate documents horizontally.
hcat :: [Doc a] -> Doc a
-- | Same as hcat, but putting breakable spaces between the
-- Docs.
hsep :: [Doc a] -> Doc a
-- | List version of $$.
vcat :: [Doc a] -> Doc a
-- | List version of $+$.
vsep :: [Doc a] -> Doc a
-- | True if the document is empty.
isEmpty :: Doc a -> Bool
-- | Returns the width of a Doc.
offset :: (IsString a, HasChars a) => Doc a -> Int
-- | Returns the minimal width of a Doc when reflowed at breakable
-- spaces.
minOffset :: HasChars a => Doc a -> Int
-- | Returns the column that would be occupied by the last laid out
-- character (assuming no wrapping).
updateColumn :: HasChars a => Doc a -> Int -> Int
-- | Returns the height of a block or other Doc.
height :: HasChars a => Doc a -> Int
-- | Returns width of a character in a monospace font: 0 for a combining
-- character, 1 for a regular character, 2 for an East Asian wide
-- character. Ambiguous characters are treated as width 1.
charWidth :: Char -> Int
-- | Get real length of string, taking into account combining and
-- double-wide characters. Ambiguous characters are treated as width 1.
realLength :: HasChars a => a -> Int
-- | Get the real length of a string, taking into account combining and
-- double-wide characters. Ambiguous characters are treated as width 1.
realLengthNarrowContext :: HasChars a => a -> Int
-- | Get the real length of a string, taking into account combining and
-- double-wide characters. Ambiguous characters are treated as width 2.
realLengthWideContext :: HasChars a => a -> Int
-- | Like realLengthNarrowContext, but avoids optimizations
-- (shortcuts). This is exposed for testing, to ensure that the
-- optimizations are safe.
realLengthNarrowContextNoShortcut :: HasChars a => a -> Int
-- | Like realLengthWideContext, but avoids optimizations
-- (shortcuts). This is exposed for testing, to ensure that the
-- optimizations are safe.
realLengthWideContextNoShortcut :: HasChars a => a -> Int
-- | Checks whether a character is a skin tone modifier.
isSkinToneModifier :: Char -> Bool
-- | Checks whether a character is an emoji variation modifier.
isEmojiVariation :: Char -> Bool
-- | Checks whether a character is a zero-width joiner.
isZWJ :: Char -> Bool
-- | Unfold a Doc into a flat list.
unfoldD :: Doc a -> [Doc a]
-- | Document, including structure relevant for layout.
data Doc a
-- | Text with specified width.
Text :: Int -> a -> Doc a
-- | A block with a width and lines.
Block :: Int -> [a] -> Doc a
-- | A vertically expandable block; when concatenated with a block, expands
-- to height of block, with each line containing the specified text.
VFill :: Int -> a -> Doc a
-- | Doc with each line prefixed with text. Note that trailing blanks are
-- omitted from the prefix when the line after it is empty.
Prefixed :: Text -> Doc a -> Doc a
-- | Doc that renders only before nonblank.
BeforeNonBlank :: Doc a -> Doc a
-- | Doc laid out flush to left margin.
Flush :: Doc a -> Doc a
-- | A space or line break, in context.
BreakingSpace :: Doc a
-- | Text printed only at start of line.
AfterBreak :: Text -> Doc a
-- | Newline unless we're at start of line.
CarriageReturn :: Doc a
-- | newline.
NewLine :: Doc a
-- | Ensure a number of blank lines.
BlankLines :: Int -> Doc a
-- | Two documents concatenated.
Concat :: Doc a -> Doc a -> Doc a
Empty :: Doc a
-- | Class abstracting over various string types that can fold over
-- characters. Minimal definition is foldrChar and
-- foldlChar, but defining the other methods can give better
-- performance.
class (IsString a, Semigroup a, Monoid a, Show a) => HasChars a
foldrChar :: HasChars a => (Char -> b -> b) -> b -> a -> b
foldlChar :: HasChars a => (b -> Char -> b) -> b -> a -> b
replicateChar :: HasChars a => Int -> Char -> a
isNull :: HasChars a => a -> Bool
splitLines :: HasChars a => a -> [a]
instance GHC.Generics.Generic (Text.DocLayout.Doc a)
instance Data.Data.Data a => Data.Data.Data (Text.DocLayout.Doc a)
instance Data.Traversable.Traversable Text.DocLayout.Doc
instance Data.Foldable.Foldable Text.DocLayout.Doc
instance GHC.Base.Functor Text.DocLayout.Doc
instance GHC.Classes.Ord a => GHC.Classes.Ord (Text.DocLayout.Doc a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Text.DocLayout.Doc a)
instance GHC.Read.Read a => GHC.Read.Read (Text.DocLayout.Doc a)
instance GHC.Show.Show a => GHC.Show.Show (Text.DocLayout.Doc a)
instance GHC.Show.Show Text.DocLayout.MatchState
instance GHC.Classes.Eq Text.DocLayout.UnicodeWidth
instance GHC.Show.Show Text.DocLayout.UnicodeWidth
instance GHC.Show.Show Text.DocLayout.EmojiInfo
instance GHC.Classes.Eq Text.DocLayout.EmojiInfo
instance GHC.Base.Semigroup Text.DocLayout.EmojiInfo
instance GHC.Base.Semigroup (Text.DocLayout.Doc a)
instance GHC.Base.Monoid (Text.DocLayout.Doc a)
instance Text.DocLayout.HasChars a => Data.String.IsString (Text.DocLayout.Doc a)
instance Text.DocLayout.HasChars Data.Text.Internal.Text
instance Text.DocLayout.HasChars GHC.Base.String
instance Text.DocLayout.HasChars Data.Text.Internal.Lazy.Text