Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
OpenAPI.Generate.Doc
Description
Utility functions for Doc
manipulation
Synopsis
- typeAliasModule :: String
- emptyDoc :: Applicative f => f Doc
- appendDoc :: Applicative f => f Doc -> f Doc -> f Doc
- generateHaddockComment :: [Text] -> Doc
- escapeText :: Text -> Text
- breakOnTokens :: [Text] -> Doc -> Doc
- reformatRecord :: Doc -> Doc
- reformatADT :: 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
typeAliasModule :: String Source #
The name of the module which contains all type aliases which would be in their own module otherwise
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).
reformatRecord :: Doc -> Doc Source #
reformatADT :: Doc -> Doc Source #
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.
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