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

CabalGild.Unstable.Action.AttachComments

Synopsis

Documentation

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

High level wrapper around field that makes this action easier to compose with other actions.

field :: Ord p => Field p -> State [Comment p] (Field (p, [Comment p])) Source #

Attaches comments to a single field. It is assumed that both the fields and comments are already sorted by their position p. This precondition is not checked. Note that comments actually end up attached to the field's name. That's because the Field type doesn't have any annotations directly on it.

name :: Ord p => Name p -> State [Comment p] (Name (p, [Comment p])) Source #

Attaches comments to a name. Note that this could be a field name or a section name.

fieldLine :: Ord p => FieldLine p -> State [Comment p] (FieldLine (p, [Comment p])) Source #

Attach comments to a field line.

sectionArg :: Ord p => SectionArg p -> State [Comment p] (SectionArg (p, [Comment p])) Source #

Attaches comments to a section argument. Note that section arguments cannot actually have comments attached. That's because section arguments must be on the same line as the section name, so all comments will end up attached to the name.

toPosition :: Ord p => p -> State [Comment p] (p, [Comment p]) Source #

Attaches comments to a position. This is the workhorse of the module. Comments are attached when their position is less than or equal to the given position. The comments are removed from the state as they are attached.