| Copyright | Oleg Grenrus |
|---|---|
| License | GPL-3.0-or-later |
| Safe Haskell | None |
| Language | Haskell2010 |
CabalFmt.Comments
Description
Synopsis
- newtype Comments = Comments [ByteString]
- unComments :: Comments -> [ByteString]
- nullComments :: Comments -> Bool
- attachComments :: ByteString -> [Field Position] -> ([Field (Position, Comments)], Comments)
- overAnn :: (FieldPath -> a -> b) -> (a -> b) -> [Field a] -> [Field b]
- extractComments :: ByteString -> [(Int, Comments)]
- data FieldPath
- fieldPathSize :: FieldPath -> Int
- fieldUniverseN :: [Field ann] -> [(FieldPath, Field ann)]
- fieldUniverse :: Field ann -> [(FieldPath, Field ann)]
- findPath :: (a -> Position) -> Int -> [(FieldPath, a)] -> Maybe FieldPath
Documentation
unComments :: Comments -> [ByteString] #
nullComments :: Comments -> Bool #
Arguments
| :: ByteString | source with comments |
| -> [Field Position] | parsed source fields |
| -> ([Field (Position, Comments)], Comments) |
Returns a Field forest with comments attached.
- Comments are attached to the field after it.
- A glitch: comments "inside" the field are attached to the field after it.
- End-of-file comments are returned separately.
extractComments :: ByteString -> [(Int, Comments)] #
Paths input paths. Essentially a list of offsets. Own type ofr safety.
Instances
| Show FieldPath # | |
| Eq FieldPath # | |
| Ord FieldPath # | |
fieldPathSize :: FieldPath -> Int #
fieldUniverseN :: [Field ann] -> [(FieldPath, Field ann)] #
fieldUniverse :: Field ann -> [(FieldPath, Field ann)] #