4 ms·
> Increased type safety is not personal preference! Sure it is! People literally make this choice all the time. If leaf can be any int then I’d suggest a value
by meheleventyone 3y ago
> Increased type safety is not personal preference!
Sure it is! People literally make this choice all the time. If leaf can be any int then I’d suggest a value that determines whether the value is a branch or a leaf. Which is drum roll how tagged unions work anyway.
You still don’t need the else clause with the early return.
Just to be clear the sum type/pattern matching is nice! But it’s perfectly acceptable to live without it and the world won’t end.