Currently, atom has a phantom type to force List to be at top level.
Do we really want to force that ? List have a performance downside currently and from the semantic point of view, it's not clear to me at all what it means to have nested lists. A possible semantic would be "Non top level lists are exactly like *". Having a semantic of an element depends if it's at the top or not seems fishy, even if it looks "intuitive".
We could separate the repetition specification from the type specification.
That would mean we remove lists from atom and we use a type component:
type 'a component =
| Opt : 'a atom -> 'a option component
| One : 'a atom -> 'a component
| List : 'a atom -> 'a list component
| List1 : 'a atom -> ('a * 'a list) component
The good point is that it gives a clearer semantic: only the components have special semantic for path and query, atoms are only regexps.
The meh point is that it adds another type layer. That could be avoided with the syntax extension and maybe mitigated with good choice of constructors (but value restriction ...).
Currently, atom has a phantom type to force List to be at top level.
*
". Having a semantic of an element depends if it's at the top or not seems fishy, even if it looks "intuitive".The good point is that it gives a clearer semantic: only the components have special semantic for path and query, atoms are only regexps. The meh point is that it adds another type layer. That could be avoided with the syntax extension and maybe mitigated with good choice of constructors (but value restriction ...).