Safe Haskell | None |
---|---|
Language | Haskell2010 |
Utility functions for Doc
manipulation
Synopsis
- emptyDoc :: Applicative f => f Doc
- appendDoc :: Applicative f => f Doc -> f Doc -> f Doc
- generateHaddockComment :: [Text] -> Doc
- escapeText :: Text -> Text
- breakOnTokens :: [Text] -> Doc -> Doc
- breakOnTokensWithReplacement :: (Text -> Text) -> [Text] -> Doc -> Doc
- sideComments :: [Text] -> Doc
- zipCodeAndComments :: [Text] -> [Text] -> Doc
- sideBySide :: Doc -> Doc -> Doc
- addOperationsModuleHeader :: String -> String -> String -> Doc -> Doc
- addSecuritySchemesModuleHeader :: String -> Doc -> Doc
- addConfigurationModuleHeader :: String -> Doc -> Doc
- createModuleHeaderWithReexports :: String -> [String] -> String -> Doc
- addModelModuleHeader :: String -> String -> [String] -> String -> Doc -> Doc
Documentation
emptyDoc :: Applicative f => f Doc Source #
Empty document inside an Applicative
(typically Q
)
appendDoc :: Applicative f => f Doc -> f Doc -> f Doc Source #
Append a Doc
to another inside an Applicative
(typically Q
)
generateHaddockComment :: [Text] -> Doc Source #
Generate a Haddock comment with multiple lines
escapeText :: Text -> Text Source #
Escape text for use in Haddock comment
breakOnTokens :: [Text] -> Doc -> Doc Source #
Add line breaks to a Doc
at all occurrences of the passed tokens (removes all other line breaks).
breakOnTokensWithReplacement :: (Text -> Text) -> [Text] -> Doc -> Doc Source #
Add line breaks to a Doc
at all occurrences of the passed tokens (removes all other line breaks).
The replacement function is used to generate the text replacing the tokens.
sideComments :: [Text] -> Doc Source #
Convert a list of lines to side comments
zipCodeAndComments :: [Text] -> [Text] -> Doc Source #
Intertwine code lines with comment lines
The code lines should have one more line (the first line is not commented)
sideBySide :: Doc -> Doc -> Doc Source #
Place two documents side-by-side, aligned at the top line
If one of the documents is longer than the other, the shorter one is extended with empty lines. The lines of the right document are aligned in the same column, no matter if the left document is shorter or longer
Example usage:
>>>
show $ sideBySide (text "a") (text "b" $$ text "c")
a b c
addOperationsModuleHeader :: String -> String -> String -> Doc -> Doc Source #
Add the module header to a module of an operation
addSecuritySchemesModuleHeader :: String -> Doc -> Doc Source #
Add the module header to the security scheme module
addConfigurationModuleHeader :: String -> Doc -> Doc Source #
Add the module header to the configuration module