Syntax Lookup

Enter some language construct you want to know more about.
This is the @tag decorator.

The @tag decorator is used to customize the discriminator for tagged variants.

ReScriptJS Output
type mood = Happy({level: int}) | Sad({level: int})

@tag("kind")
type mood2 = Happy({level: int}) | Sad({level: int})

let mood: mood = Happy({level: 10})
let mood2: mood2 = Happy({level: 11})

Notice the different discriminators in the JS output: TAG in mood vs kind in mood2.

Read more about using @tag with variants.

References