Hacker News new | ask | show | jobs
by agentgt 3660 days ago
For me it boils down to variant types (also known as Algebraic Data Types but I prefer the ML nomenclature) and the corresponding pattern matching that comes with it. This is IMO the major feature that makes FP languages so damn safe.

Everyone talks about higher order functions and generic types but lots of languages have that.... the really good ones have ADTs.

Oh what I would give to have ADTs in Java. I would stop using Exceptions for errors (not all exceptions are bad just most of them). I would stop using the annoying visitor pattern... That reminds me that I need to rexamine Derive4J

2 comments

I had a similar epiphany when I started using Rust. I hadn't really understood the power of ADTs, having only come across them in Haskell, until I saw them in an otherwise more familiar language, and it totally changed the way I think about things.
Have you looked at the Yeti language for the jvm?