Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- run :: Applicative m => CabalSpecVersion -> ([Field (Position, [Comment Position])], cs) -> m ([Field (Position, [Comment Position])], cs)
- fields :: CabalSpecVersion -> [Field (Position, [Comment Position])] -> [Field (Position, [Comment Position])]
- field :: Field (Position, [Comment Position]) -> Field (Position, [Comment Position])
- relevantFieldNames :: Set FieldName
- fieldLines :: Field (Position, [Comment Position]) -> [FieldLine (Position, [Comment Position])] -> [FieldLine (Position, [Comment Position])]
- fixRows :: [FieldLine (Position, [Comment Position])] -> [FieldLine (Position, [Comment Position])]
- fixCols :: Field (Position, [Comment Position]) -> [FieldLine (Position, [Comment Position])] -> [FieldLine (Position, [Comment Position])]
- fieldLineToCol :: FieldLine (Position, cs) -> Int
- fieldLineToFirstRow :: FieldLine (Position, [Comment Position]) -> Int
- fieldLineToLastRow :: FieldLine (Position, cs) -> Int
- fieldToRow :: Field (Position, cs) -> Int
- reindent :: Int -> FieldLine (Position, cs) -> FieldLine (Position, cs)
- rowToFieldLine :: Int -> FieldLine (Position, [c])
Documentation
run :: Applicative m => CabalSpecVersion -> ([Field (Position, [Comment Position])], cs) -> m ([Field (Position, [Comment Position])], cs) Source #
A wrapper around fields
to allow this to be composed with other actions.
fields :: CabalSpecVersion -> [Field (Position, [Comment Position])] -> [Field (Position, [Comment Position])] Source #
Reflows the free text field values if the Cabal spec version is recent
enough (at least 3.0
).
Note that this requires comments to be already attached. That's because comments should not be attached to blank lines, which this function will insert.
field :: Field (Position, [Comment Position]) -> Field (Position, [Comment Position]) Source #
Reflows the free text field value if applicable. Otherwise returns the field as is. If the field is a section, the fields within the section will be recursively reflowed.
relevantFieldNames :: Set FieldName Source #
The names of the fields that should be reflowed.
fieldLines :: Field (Position, [Comment Position]) -> [FieldLine (Position, [Comment Position])] -> [FieldLine (Position, [Comment Position])] Source #
fixRows :: [FieldLine (Position, [Comment Position])] -> [FieldLine (Position, [Comment Position])] Source #
Inserts blank lines between field lines if necessary.
fixCols :: Field (Position, [Comment Position]) -> [FieldLine (Position, [Comment Position])] -> [FieldLine (Position, [Comment Position])] Source #
Reindents field lines by finding the least indented line and adjusting the other lines relative to that one. Note that if the first field line is on the same line as the field itself, it will never be reindented.
fieldLineToCol :: FieldLine (Position, cs) -> Int Source #
Extracts the column number from a field line.
fieldLineToFirstRow :: FieldLine (Position, [Comment Position]) -> Int Source #
Extracts the first row number from a field line, which might belong to one of its comments.
fieldLineToLastRow :: FieldLine (Position, cs) -> Int Source #
Extracts the last row number from a field line, which will not belong to any of its comments.