Eigenstate: myrddin-dev mailing list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Union tag comparison


Hello,

Say, I have a 
type expr = union
    `Oadd(expr#, expr#)
    `Oneg(expr#)
;;

I want to compare two expr values to determine whether they are of the same Op.
As I know, I can define a function that maps each variant into a distinct integer or string.
But It'd be nice if it can be as simple as how C  does: 'a.Op == b.Op'.
I am thinking about a builtin function that retrieves the internal integer value of the union tag.
Am I missing something?

Follow-Ups:
Re: Union tag comparisonori@xxxxxxxxxxxxxx