News for hackers. Stuff that matters.
Re:Why Haskell? by wavemode on Thursday September 12, 2024 @10:59AM (#41521728)
> 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.

Re:Why Haskell? by 1-more on Thursday September 12, 2024 @12:24PM (#41522574)
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