Re:Why Haskell?
by thfuran on Thursday September 12, 2024 @11:55AM
(#41522281)
Sealed classes still won't let you have e.g. String|Integer, though I'll grant you that java is certainly mainstream.
[ Parent
| on HN ]
Re:Why Haskell?
by kagakuninja on Thursday September 12, 2024 @01:28PM
(#41523264)
Scala 3 has had union types for 4 years now. Scala can be used to do Haskell style pure FP, but with much better tooling. And it has the power of the JVM, you can fall back to Java libraries if you want.
You don't really need `String|Integer`, for most usecases an isomorphic type that you can exhaustively pattern match on is more than enough, and sealed classes (along with the support in `switch` expressions) does exactly that.