Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Scala does not have true sum types though, it uses subtyping to encode them. When I tried it, I found that pattern matching was often unsafe. I am glad that Scala has raised awareness of FP, but its implementation of FP is heavily compromised by its focus on OO.


Scala does have sum types up to generic type erasure; see "sealed trait". (At which point you might want to reevaluate your strategy, so no big loss.)


Dotty (the next Scala) does have true sum types.




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: