3 ms·
Does the Either type from the vavr library for Java cover this? https://www.baeldung.com/vavr-either https://www.baeldung.com/vavr-either
by timmattison 6y ago
Does the Either type from the vavr library for Java cover this? https://www.baeldung.com/vavr-either https://www.baeldung.com/vavr-either
- damnyou 6y agoHaving a type available in an optional library is not the same thing as having them baked in from the beginning. The absence of sum types warps a language in grotesquely terrible ways, such as Go's err != nil patterns or Java's exception system and visitor patterns.
- PhantomBKB 6y agoI wouldn't say no, because it's built with the right spirit in mind. But at the same time, it's different from languages have native support for sum types. Advantage of sum type is that it can be matched exhaustively like an enum, but at the same time it's flexible to contain any data like a data class.