DEV Community

Discussion on: Haskell as an alternative to TypeScript

 
leob profile image
leob • Edited

Yes indeed, the way "optional" values are treated - same story for errors/exceptions, both Haskel and Rust have no try/catch, errors are propagated via return values. Rust also seems to utilize "algebraic data types" in the same fashion as Haskell does, whereas other languages would use more of an OO approach with classes/objects. Following along with the Rust tutorial I constantly thought "deja vue" and then "Haskell" !

And both are impressive in how much checking the compiler does for you - if used properly you can achieve a large degree of confidence that your code "does the right thing" even before running it.

The only thing Rust seems to be missing is tail recursion, this also stops it from being seen as a "pure" FP language, typically you'd still write imperative/procedural loops in Rust.