Distribution.Client.Init.Format

cabal-install-3.12.1.0: The command-line interface for Cabal and Hackage.

Copyright | (c) Brent Yorgey 2009
License | BSD-like
Maintainer | cabal-devel@haskell.org
Stability | provisional
Portability | portable
Safe Haskell | None
Language | Haskell2010

Distribution.Client.Init.Format

Contents

- cabal file formatters
- stanza generation

Description

Pretty printing and field formatting utilities used for file creation.

Synopsis

- listFieldS :: [String] -> Doc
- field :: Pretty b => FieldName -> (a -> b) -> a -> [String] -> Bool -> WriteOpts -> PrettyField FieldAnnotation
- fieldD :: FieldName -> Doc -> [String] -> Bool -> WriteOpts -> PrettyField FieldAnnotation
- commentedOutWithComments :: CommentPosition -> FieldAnnotation
- withComments :: CommentPosition -> FieldAnnotation
- annNoComments :: FieldAnnotation
- postProcessFieldLines :: FieldAnnotation -> [String] -> [String]
- mkCommonStanza :: WriteOpts -> PrettyField FieldAnnotation
- mkLibStanza :: WriteOpts -> LibTarget -> PrettyField FieldAnnotation
- mkExeStanza :: WriteOpts -> ExeTarget -> PrettyField FieldAnnotation
- mkTestStanza :: WriteOpts -> TestTarget -> PrettyField FieldAnnotation
- mkPkgDescription :: WriteOpts -> PkgDescription -> [PrettyField FieldAnnotation]

# cabal file formatters

listFieldS :: [String] -> Doc #

field :: Pretty b => FieldName -> (a -> b) -> a -> [String] -> Bool -> WriteOpts -> PrettyField FieldAnnotation #

Construct a `PrettyField` from a field that can be automatically converted to a `Doc` via `display`.

fieldD #

Arguments

:: FieldName | Name of the field
-> Doc | Field contents
-> [String] | Comment to explain the field
-> Bool | Should the field be included (commented out) even if blank?
-> WriteOpts |
-> PrettyField FieldAnnotation |

Construct a `PrettyField` from a `Doc` Flag.

commentedOutWithComments :: CommentPosition -> FieldAnnotation #

A field annotation instructing the pretty printer to comment out the field and any contents, with no comments.

withComments :: CommentPosition -> FieldAnnotation #

A field annotation with the specified comment lines.

annNoComments :: FieldAnnotation #

A field annotation with no comments.

postProcessFieldLines :: FieldAnnotation -> [String] -> [String] #

# stanza generation

mkCommonStanza :: WriteOpts -> PrettyField FieldAnnotation #

mkLibStanza :: WriteOpts -> LibTarget -> PrettyField FieldAnnotation #

mkExeStanza :: WriteOpts -> ExeTarget -> PrettyField FieldAnnotation #

mkTestStanza :: WriteOpts -> TestTarget -> PrettyField FieldAnnotation #

mkPkgDescription :: WriteOpts -> PkgDescription -> [PrettyField FieldAnnotation] #