cabal-gild-1.3.1.0: Formats package descriptions.
Safe HaskellSafe-Inferred
LanguageHaskell2010

CabalGild.Unstable.Action.FormatFields

Synopsis

Documentation

run :: Applicative m => CabalSpecVersion -> ([Field (p, [c])], [c]) -> m ([Field (p, [c])], [c]) Source #

A wrapper around field to allow this to be composed with other actions.

field :: CabalSpecVersion -> Field (p, [c]) -> Field (p, [c]) Source #

Formats the given field, if applicable. Otherwise returns the field as is. If the field is a section, the fields within the section will be recursively formatted.

fieldLines :: CabalSpecVersion -> p -> [FieldLine (p, [c])] -> SomeParsecParser -> [FieldLine (p, [c])] Source #

Attempts to parse the given field lines using the given parser. If parsing fails, the field lines will be returned as is. Comments within the field lines will be preserved but "float" up to the top.

style :: Style Source #

This style attempts to force everything to be on its own line.

parsers :: Map FieldName SomeParsecParser Source #

A map from field names to parsers. This determines which parser should be used for which field. And consequently this determines which fields will be formatted.

Perhaps instead of being keyed on FieldName, this should be keyed on a path (list of field names) instead. That's because a field like build-depends only really makes sense within a section like library. Fortunately field names are unique enough that this hasn't been a problem yet.