I am currently working annotations into the parser, provided them as a separate structure at the end of the parse, indexed to the original by SrcSpan and AST element type.
The question I have is how to capture commas and semicolons in lists of items.
There are at least three ways of doing this
1. Make sure each of the items is Located, and add the possible comma location to the annotation structure for it.
This has the drawback that all instances of the AST item annotation have the possible comma location in them, and it does not cope with multiple separators where these are allowed.
2. Introduce a new hsSyn structure to explicitly capture comma-separated lists.
This is the current approach I am taking, modelled on the OrdList implementation, but with an extra constructor to capture the separator location.
Thus
```
data HsCommaList a
= Empty
| Cons a (HsCommaList a)
| ExtraComma SrcSpan (HsCommaList a)
-- ^ We need a SrcSpan for the annotation
| Snoc (HsCommaList a) a
| Two (HsCommaList a) -- Invariant: non-empty
(HsCommaList a) -- Invariant: non-empty
```
3. Change the lists to be of type `[Either SrcSpan a]` to explicitly capture the comma locations in the list.