Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell98 |
Options.Applicative.Help.Pretty
Synopsis
- class Pretty a where
- pretty :: a -> Doc ann
- prettyList :: [a] -> Doc ann
- group :: Doc ann -> Doc ann
- (<>) :: Semigroup a => a -> a -> a
- data SimpleDocStream ann
- = SFail
- | SEmpty
- | SChar !Char (SimpleDocStream ann)
- | SText !Int !Text (SimpleDocStream ann)
- | SLine !Int (SimpleDocStream ann)
- | SAnnPush ann (SimpleDocStream ann)
- | SAnnPop (SimpleDocStream ann)
- flatAlt :: Doc ann -> Doc ann -> Doc ann
- line :: Doc ann
- softline :: Doc ann
- nesting :: (Int -> Doc ann) -> Doc ann
- column :: (Int -> Doc ann) -> Doc ann
- nest :: Int -> Doc ann -> Doc ann
- (<+>) :: Doc ann -> Doc ann -> Doc ann
- align :: Doc ann -> Doc ann
- indent :: Int -> Doc ann -> Doc ann
- layoutPretty :: LayoutOptions -> Doc ann -> SimpleDocStream ann
- newtype LayoutOptions = LayoutOptions {}
- data PageWidth
- = AvailablePerLine !Int !Double
- | Unbounded
- list :: [Doc ann] -> Doc ann
- data FusionDepth
- alterAnnotations :: (ann -> [ann']) -> Doc ann -> Doc ann'
- alterAnnotationsS :: (ann -> Maybe ann') -> SimpleDocStream ann -> SimpleDocStream ann'
- annotate :: ann -> Doc ann -> Doc ann
- cat :: [Doc ann] -> Doc ann
- concatWith :: Foldable t => (Doc ann -> Doc ann -> Doc ann) -> t (Doc ann) -> Doc ann
- defaultLayoutOptions :: LayoutOptions
- emptyDoc :: Doc ann
- enclose :: Doc ann -> Doc ann -> Doc ann -> Doc ann
- encloseSep :: Doc ann -> Doc ann -> Doc ann -> [Doc ann] -> Doc ann
- fill :: Int -> Doc ann -> Doc ann
- fillBreak :: Int -> Doc ann -> Doc ann
- fillCat :: [Doc ann] -> Doc ann
- fillSep :: [Doc ann] -> Doc ann
- fuse :: FusionDepth -> Doc ann -> Doc ann
- hang :: Int -> Doc ann -> Doc ann
- hardline :: Doc ann
- hcat :: [Doc ann] -> Doc ann
- hsep :: [Doc ann] -> Doc ann
- layoutCompact :: Doc ann1 -> SimpleDocStream ann2
- layoutSmart :: LayoutOptions -> Doc ann -> SimpleDocStream ann
- line' :: Doc ann
- pageWidth :: (PageWidth -> Doc ann) -> Doc ann
- plural :: (Num amount, Eq amount) => doc -> doc -> amount -> doc
- punctuate :: Doc ann -> [Doc ann] -> [Doc ann]
- reAnnotate :: (ann -> ann') -> Doc ann -> Doc ann'
- reAnnotateS :: (ann -> ann') -> SimpleDocStream ann -> SimpleDocStream ann'
- removeTrailingWhitespace :: SimpleDocStream ann -> SimpleDocStream ann
- sep :: [Doc ann] -> Doc ann
- softline' :: Doc ann
- surround :: Doc ann -> Doc ann -> Doc ann -> Doc ann
- tupled :: [Doc ann] -> Doc ann
- unAnnotate :: Doc ann -> Doc xxx
- unAnnotateS :: SimpleDocStream ann -> SimpleDocStream xxx
- unsafeViaShow :: Show a => a -> Doc ann
- vcat :: [Doc ann] -> Doc ann
- viaShow :: Show a => a -> Doc ann
- vsep :: [Doc ann] -> Doc ann
- width :: Doc ann -> (Int -> Doc ann) -> Doc ann
- angles :: Doc ann -> Doc ann
- backslash :: Doc ann
- braces :: Doc ann -> Doc ann
- brackets :: Doc ann -> Doc ann
- colon :: Doc ann
- comma :: Doc ann
- dot :: Doc ann
- dquote :: Doc ann
- dquotes :: Doc ann -> Doc ann
- equals :: Doc ann
- langle :: Doc ann
- lbrace :: Doc ann
- lbracket :: Doc ann
- lparen :: Doc ann
- parens :: Doc ann -> Doc ann
- pipe :: Doc ann
- rangle :: Doc ann
- rbrace :: Doc ann
- rbracket :: Doc ann
- rparen :: Doc ann
- semi :: Doc ann
- slash :: Doc ann
- space :: Doc ann
- squote :: Doc ann
- squotes :: Doc ann -> Doc ann
- data AnsiStyle
- data Color
- data Bold = Bold
- data Intensity
- data Italicized = Italicized
- data Underlined = Underlined
- bgColor :: Color -> AnsiStyle
- bgColorDull :: Color -> AnsiStyle
- bold :: AnsiStyle
- color :: Color -> AnsiStyle
- colorDull :: Color -> AnsiStyle
- hPutDoc :: Handle -> Doc AnsiStyle -> IO ()
- italicized :: AnsiStyle
- putDoc :: Doc AnsiStyle -> IO ()
- renderIO :: Handle -> SimpleDocStream AnsiStyle -> IO ()
- renderLazy :: SimpleDocStream AnsiStyle -> Text
- renderStrict :: SimpleDocStream AnsiStyle -> Text
- underlined :: AnsiStyle
- type Doc = Doc AnsiStyle
- type SimpleDoc = SimpleDocStream AnsiStyle
- (.$.) :: Doc -> Doc -> Doc
- (</>) :: Doc -> Doc -> Doc
- groupOrNestLine :: Doc -> Doc
- altSep :: Doc -> Doc -> Doc
- hangAtIfOver :: Int -> Int -> Doc -> Doc
- prettyString :: Double -> Int -> Doc -> String
Documentation
Minimal complete definition
Instances
data SimpleDocStream ann #
Constructors
SFail | |
SEmpty | |
SChar !Char (SimpleDocStream ann) | |
SText !Int !Text (SimpleDocStream ann) | |
SLine !Int (SimpleDocStream ann) | |
SAnnPush ann (SimpleDocStream ann) | |
SAnnPop (SimpleDocStream ann) |
Instances
Functor SimpleDocStream | |||||
Defined in Prettyprinter.Internal Methods fmap :: (a -> b) -> SimpleDocStream a -> SimpleDocStream b (<$) :: a -> SimpleDocStream b -> SimpleDocStream a # | |||||
Foldable SimpleDocStream | |||||
Defined in Prettyprinter.Internal Methods fold :: Monoid m => SimpleDocStream m -> m foldMap :: Monoid m => (a -> m) -> SimpleDocStream a -> m foldMap' :: Monoid m => (a -> m) -> SimpleDocStream a -> m foldr :: (a -> b -> b) -> b -> SimpleDocStream a -> b foldr' :: (a -> b -> b) -> b -> SimpleDocStream a -> b foldl :: (b -> a -> b) -> b -> SimpleDocStream a -> b foldl' :: (b -> a -> b) -> b -> SimpleDocStream a -> b foldr1 :: (a -> a -> a) -> SimpleDocStream a -> a foldl1 :: (a -> a -> a) -> SimpleDocStream a -> a toList :: SimpleDocStream a -> [a] null :: SimpleDocStream a -> Bool length :: SimpleDocStream a -> Int elem :: Eq a => a -> SimpleDocStream a -> Bool maximum :: Ord a => SimpleDocStream a -> a minimum :: Ord a => SimpleDocStream a -> a sum :: Num a => SimpleDocStream a -> a product :: Num a => SimpleDocStream a -> a | |||||
Traversable SimpleDocStream | |||||
Defined in Prettyprinter.Internal Methods traverse :: Applicative f => (a -> f b) -> SimpleDocStream a -> f (SimpleDocStream b) sequenceA :: Applicative f => SimpleDocStream (f a) -> f (SimpleDocStream a) mapM :: Monad m => (a -> m b) -> SimpleDocStream a -> m (SimpleDocStream b) sequence :: Monad m => SimpleDocStream (m a) -> m (SimpleDocStream a) | |||||
Generic (SimpleDocStream ann) | |||||
Defined in Prettyprinter.Internal Associated Types
Methods from :: SimpleDocStream ann -> Rep (SimpleDocStream ann) x to :: Rep (SimpleDocStream ann) x -> SimpleDocStream ann | |||||
Show ann => Show (SimpleDocStream ann) | |||||
Defined in Prettyprinter.Internal Methods showsPrec :: Int -> SimpleDocStream ann -> ShowS show :: SimpleDocStream ann -> String showList :: [SimpleDocStream ann] -> ShowS | |||||
Eq ann => Eq (SimpleDocStream ann) | |||||
Defined in Prettyprinter.Internal Methods (==) :: SimpleDocStream ann -> SimpleDocStream ann -> Bool (/=) :: SimpleDocStream ann -> SimpleDocStream ann -> Bool | |||||
Ord ann => Ord (SimpleDocStream ann) | |||||
Defined in Prettyprinter.Internal Methods compare :: SimpleDocStream ann -> SimpleDocStream ann -> Ordering (<) :: SimpleDocStream ann -> SimpleDocStream ann -> Bool (<=) :: SimpleDocStream ann -> SimpleDocStream ann -> Bool (>) :: SimpleDocStream ann -> SimpleDocStream ann -> Bool (>=) :: SimpleDocStream ann -> SimpleDocStream ann -> Bool max :: SimpleDocStream ann -> SimpleDocStream ann -> SimpleDocStream ann min :: SimpleDocStream ann -> SimpleDocStream ann -> SimpleDocStream ann | |||||
type Rep (SimpleDocStream ann) | |||||
Defined in Prettyprinter.Internal type Rep (SimpleDocStream ann) = D1 ('MetaData "SimpleDocStream" "Prettyprinter.Internal" "prettyprinter-1.7.1-7D5f77mMMD74tNaunHE5E6" 'False) ((C1 ('MetaCons "SFail" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "SEmpty" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "SChar" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 Char) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (SimpleDocStream ann))))) :+: ((C1 ('MetaCons "SText" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 Int) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (SimpleDocStream ann)))) :+: C1 ('MetaCons "SLine" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 Int) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (SimpleDocStream ann)))) :+: (C1 ('MetaCons "SAnnPush" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ann) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (SimpleDocStream ann))) :+: C1 ('MetaCons "SAnnPop" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (SimpleDocStream ann)))))) |
layoutPretty :: LayoutOptions -> Doc ann -> SimpleDocStream ann #
newtype LayoutOptions #
Constructors
LayoutOptions | |
Fields |
Instances
Show LayoutOptions | |
Defined in Prettyprinter.Internal Methods showsPrec :: Int -> LayoutOptions -> ShowS show :: LayoutOptions -> String showList :: [LayoutOptions] -> ShowS | |
Eq LayoutOptions | |
Defined in Prettyprinter.Internal | |
Ord LayoutOptions | |
Defined in Prettyprinter.Internal Methods compare :: LayoutOptions -> LayoutOptions -> Ordering (<) :: LayoutOptions -> LayoutOptions -> Bool (<=) :: LayoutOptions -> LayoutOptions -> Bool (>) :: LayoutOptions -> LayoutOptions -> Bool (>=) :: LayoutOptions -> LayoutOptions -> Bool max :: LayoutOptions -> LayoutOptions -> LayoutOptions min :: LayoutOptions -> LayoutOptions -> LayoutOptions |
Constructors
AvailablePerLine !Int !Double | |
Unbounded |
Instances
Show PageWidth | |
Eq PageWidth | |
Ord PageWidth | |
Defined in Prettyprinter.Internal |
data FusionDepth #
Instances
Show FusionDepth | |
Defined in Prettyprinter.Internal Methods showsPrec :: Int -> FusionDepth -> ShowS show :: FusionDepth -> String showList :: [FusionDepth] -> ShowS | |
Eq FusionDepth | |
Defined in Prettyprinter.Internal | |
Ord FusionDepth | |
Defined in Prettyprinter.Internal Methods compare :: FusionDepth -> FusionDepth -> Ordering (<) :: FusionDepth -> FusionDepth -> Bool (<=) :: FusionDepth -> FusionDepth -> Bool (>) :: FusionDepth -> FusionDepth -> Bool (>=) :: FusionDepth -> FusionDepth -> Bool max :: FusionDepth -> FusionDepth -> FusionDepth min :: FusionDepth -> FusionDepth -> FusionDepth |
alterAnnotations :: (ann -> [ann']) -> Doc ann -> Doc ann' #
alterAnnotationsS :: (ann -> Maybe ann') -> SimpleDocStream ann -> SimpleDocStream ann' #
concatWith :: Foldable t => (Doc ann -> Doc ann -> Doc ann) -> t (Doc ann) -> Doc ann #
encloseSep :: Doc ann -> Doc ann -> Doc ann -> [Doc ann] -> Doc ann #
fuse :: FusionDepth -> Doc ann -> Doc ann #
layoutCompact :: Doc ann1 -> SimpleDocStream ann2 #
layoutSmart :: LayoutOptions -> Doc ann -> SimpleDocStream ann #
reAnnotate :: (ann -> ann') -> Doc ann -> Doc ann' #
reAnnotateS :: (ann -> ann') -> SimpleDocStream ann -> SimpleDocStream ann' #
removeTrailingWhitespace :: SimpleDocStream ann -> SimpleDocStream ann #
unAnnotate :: Doc ann -> Doc xxx #
unAnnotateS :: SimpleDocStream ann -> SimpleDocStream xxx #
unsafeViaShow :: Show a => a -> Doc ann #
Instances
Show Intensity | |
Eq Intensity | |
Ord Intensity | |
Defined in Prettyprinter.Render.Terminal.Internal |
data Italicized #
Constructors
Italicized |
Instances
Show Italicized | |
Defined in Prettyprinter.Render.Terminal.Internal Methods showsPrec :: Int -> Italicized -> ShowS show :: Italicized -> String showList :: [Italicized] -> ShowS | |
Eq Italicized | |
Defined in Prettyprinter.Render.Terminal.Internal | |
Ord Italicized | |
Defined in Prettyprinter.Render.Terminal.Internal Methods compare :: Italicized -> Italicized -> Ordering (<) :: Italicized -> Italicized -> Bool (<=) :: Italicized -> Italicized -> Bool (>) :: Italicized -> Italicized -> Bool (>=) :: Italicized -> Italicized -> Bool max :: Italicized -> Italicized -> Italicized min :: Italicized -> Italicized -> Italicized |
data Underlined #
Constructors
Underlined |
Instances
Show Underlined | |
Defined in Prettyprinter.Render.Terminal.Internal Methods showsPrec :: Int -> Underlined -> ShowS show :: Underlined -> String showList :: [Underlined] -> ShowS | |
Eq Underlined | |
Defined in Prettyprinter.Render.Terminal.Internal | |
Ord Underlined | |
Defined in Prettyprinter.Render.Terminal.Internal Methods compare :: Underlined -> Underlined -> Ordering (<) :: Underlined -> Underlined -> Bool (<=) :: Underlined -> Underlined -> Bool (>) :: Underlined -> Underlined -> Bool (>=) :: Underlined -> Underlined -> Bool max :: Underlined -> Underlined -> Underlined min :: Underlined -> Underlined -> Underlined |
bgColorDull :: Color -> AnsiStyle #
italicized :: AnsiStyle #
renderIO :: Handle -> SimpleDocStream AnsiStyle -> IO () #
renderLazy :: SimpleDocStream AnsiStyle -> Text #
renderStrict :: SimpleDocStream AnsiStyle -> Text #
underlined :: AnsiStyle #
type SimpleDoc = SimpleDocStream AnsiStyle Source #
groupOrNestLine :: Doc -> Doc Source #
Render flattened text on this line, or start a new line before rendering any text.
This will also nest subsequent lines in the group.
altSep :: Doc -> Doc -> Doc Source #
Separate items in an alternative with a pipe.
If the first document and the pipe don't fit on the line, then mandatorily flow the next entry onto the following line.
The (//) softbreak ensures that if the document does fit on the line, there is at least a space, but it's possible for y to still appear on the next line.
hangAtIfOver :: Int -> Int -> Doc -> Doc Source #
Printer hacks to get nice indentation for long commands and subcommands.
If we're starting this section over the desired width (usually 1/3 of the ribbon), then we will make a line break, indent all of the usage, and go.
The ifAtRoot is an interesting clause. If this whole
operation is put under a group
then the linebreak
will disappear; then item d will therefore not be at
the starting column, and it won't be indented more.
prettyString :: Double -> Int -> Doc -> String Source #