HsYAML
HsYAML copied to clipboard
Inline trailing comments fail to round trip
trafficstars
It seems like the comment event is missing some information to indicate if it is inline or standalone:
key: "value" # a comment
Results in (after passing through YE.writeEvents YT.UTF8 . map eEvent . rights . YE.parseEvents
key: "value"
# a comment
The events are:
MappingStart Nothing Nothing Block
Scalar Nothing Nothing Plain "key"
Scalar Nothing Nothing DoubleQuoted "value"
Comment " a comment"
MappingEnd
Would it be possible to add an attribute to the Comment event to preserve its line position?
Yes, some comment position related information is not preserved in a round trip. See https://hackage.haskell.org/package/HsYAML-0.2.1.0/docs/Data-YAML-Event.html#g:4 for more details.
Thank you for the reference. Isn't this something that could be improved?