type Foo = int | bool
    
    assert Foo(42) is Foo
    assert Foo(true) is Foo
    
    
    Run

Variant Type is probably what you are looking for.

Reply via email to