Many languages has functions in Enums. They are just a specialized Class/Struct. Rust, Swift and Java among many languages has this.
Enums are just special classes no? Why can't they have functions defined on them?
Java enums also have functions.
If they didn't we would need to write separate helper classes.
Can you give a reason why we should not have them?
Java enums are essentially an in-built singleton pattern where only the given entries can exist. They are not necessarily analogous with sum types, even though rust sort of washes the two together.
It's not unreasonable to group functions with the type they operate on.