Is there a good way to check if a variable is a variant with a particular tag without doing a match? I think the answer is no.
My motivation is this: I want to write a small function
mustbe a b that confirms that the variant
b has the tag given in
a, as in
mustbe Float x
or some such. However, I don’t think this is possible, especially if the variants have associated data.
(Having this function would save me a bunch of repeated code in some ad hoc recursive descent parsing I’m doing, but I’m guessing that I can’t avoid it.)