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

> I feel like part of the problem is Haskell's extremism towards purity and immutability

Eh. Elm has achieved quite a bit of success just by having good tooling and a good ecosystem. Says something about people's willingness to learn pure functional programming, if the situation is right.

> I find some code easier to express with procedural/mutable loops than recursion

This is usually a familiarity problem, IMO.

I often say: people think mastering Haskell is about mastering monads. But it's actually about mastering folds.



the best intro to writing Haskell for me was writing Elm. The best intro to writing Elm was writing pointfree Codewars kata solutions in JS using

    with(require("ramda")) fn = pipe(…)
And yep, you end up with a lot of folds (well, reduces) where that ellipsis is. Or related functions that are really folds.

For those wondering `with` in JS is a bit like `extract` in PHP except it creates a new context right after itself rather than modify the context it finds itself in. It's super deprecated because it's inscrutable and silly except in this case and/or when you need to solve Codewars katas in a limited number of characters.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

https://www.php.net/manual/en/function.extract.php

EDIT ramda is a nice utility library in JS that supports partial application of arguments in arbitrary order https://ramdajs.com/docs/#subtract




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

Search: