Open liyishuai opened 4 years ago
I'd classify that as working as expected, but it might also be a good idea to generalize match_con
a little. At the same time, the match_con
stuff is really meant to be used in a very formulaic manner entirely derived from the type declaration. If you want to have any say in the encoding, you might want to just pattern-match on the S-expression directly in this definition.
Yea I can live with this feature, provided documentation.
Sadly, generalizing match_con
to allow arbitrary atoms as constructor tags breaks the current API. I hoped coercions would smooth this out but they don't. We could have the generalized version as a separate function, but I still feel like this is a rather odd use case. Instead, I can add some documentation about defining parsers by manual pattern-matching.
Is it a bug or feature?