Cabal-3.2.1.0: A framework for packaging Haskell software
Safe HaskellNone
LanguageHaskell2010

Distribution.Fields.Pretty

Description

Cabal-like file AST types: Field, Section etc,

This (intermediate) data type is used for pretty-printing.

Since: Cabal-3.0.0.0

Synopsis

Fields

data PrettyField ann Source #

Instances

Instances details
Functor PrettyField # 
Instance details

Defined in Distribution.Fields.Pretty

Methods

fmap :: (a -> b) -> PrettyField a -> PrettyField b Source #

(<$) :: a -> PrettyField b -> PrettyField a Source #

Foldable PrettyField # 
Instance details

Defined in Distribution.Fields.Pretty

Methods

fold :: Monoid m => PrettyField m -> m Source #

foldMap :: Monoid m => (a -> m) -> PrettyField a -> m Source #

foldMap' :: Monoid m => (a -> m) -> PrettyField a -> m Source #

foldr :: (a -> b -> b) -> b -> PrettyField a -> b Source #

foldr' :: (a -> b -> b) -> b -> PrettyField a -> b Source #

foldl :: (b -> a -> b) -> b -> PrettyField a -> b Source #

foldl' :: (b -> a -> b) -> b -> PrettyField a -> b Source #

foldr1 :: (a -> a -> a) -> PrettyField a -> a Source #

foldl1 :: (a -> a -> a) -> PrettyField a -> a Source #

toList :: PrettyField a -> [a] Source #

null :: PrettyField a -> Bool Source #

length :: PrettyField a -> Int Source #

elem :: Eq a => a -> PrettyField a -> Bool Source #

maximum :: Ord a => PrettyField a -> a Source #

minimum :: Ord a => PrettyField a -> a Source #

sum :: Num a => PrettyField a -> a Source #

product :: Num a => PrettyField a -> a Source #

Traversable PrettyField # 
Instance details

Defined in Distribution.Fields.Pretty

Methods

traverse :: Applicative f => (a -> f b) -> PrettyField a -> f (PrettyField b) Source #

sequenceA :: Applicative f => PrettyField (f a) -> f (PrettyField a) Source #

mapM :: Monad m => (a -> m b) -> PrettyField a -> m (PrettyField b) Source #

sequence :: Monad m => PrettyField (m a) -> m (PrettyField a) Source #

showFields :: (ann -> [String]) -> [PrettyField ann] -> String Source #

Prettyprint a list of fields.

Note: the first argument should return Strings without newlines and properly prefixes (with --) to count as comments. This unsafety is left in place so one could generate empty lines between comment lines.

showFields' :: (ann -> [String]) -> Int -> [PrettyField ann] -> String Source #

showFields with user specified indentation.

Transformation from Field

fromParsecFields :: [Field ann] -> [PrettyField ann] Source #

Simple variant of genericFromParsecField

genericFromParsecFields Source #

Arguments

:: Applicative f 
=> (FieldName -> [FieldLine ann] -> f Doc)

transform field contents

-> (FieldName -> [SectionArg ann] -> f [Doc])

transform section arguments

-> [Field ann] 
-> f [PrettyField ann]