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

`Result<T, E>` comes from Haskell's `Either a b` type. F# also has a `Result<'T, 'E>` type.

It's funny how often functional programming languages lead the way, but imperative languages end up with the credit.



Actually (insert nerd emoji) this is a direct descendant from tagged union type, which existed in ALGLO 68, an imperative language.

Java's checked exception is just an (very anti-ergonomic) implementation of tagged union type.


OK, but it wasn't until functional programming came along that tagged unions were recognized as a natural way to implement sum types, which is how they are used in modern programming. The old idea of a "variant" has pretty much faded away.


Algebraic types, immutable structures, lambdas, higher-order functions.

I think FP receives a lot of "credit."

Albeit the "pure" FP languages aren't popular, because 99% FP is really hard.




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

Search: