4 ms·
It’s not that it’s good or bad - mutation can only happen in a monad (IO or ST or similar). The monad is the encapsulation and that encapsulation is enforced by
by efnx 4y ago
It’s not that it’s good or bad - mutation can only happen in a monad (IO or ST or similar). The monad is the encapsulation and that encapsulation is enforced by the type checker.
It’s actually quite liberating not having to worry about what’s “right or wrong” and instead just do whatever you like that compiles.
I suggest getting started with Haskell through http://www.learnyouahaskell.com/ http://www.learnyouahaskell.com/ - it was my favorite.
- galaxyLogic 4y agoI'm looking at it not from the perspective of "Which language is the best?" but from the point of view of I'm working in a specific language now, what are the principles of "Pure FP" that I could benefit from when using that language. How should I "encapsulate state" in JavaScript for instance? If the principles of FP are great surely they must be applicable in any Turing-complete programming language. The (Haskell etc.) compiler is no doubt a great tool, great at type-checking. But I see using any specific compiler or type-checker as a tooling issue, not a foundational insight about FP.
- efnx 4y agoAh yes, indeed there are benefits that come from programming in Haskell that can be applied to JavaScript, but I think that without the compiler it’s very hard to guarantee success.