Hacker News new | ask | show | jobs
by slaymaker1907 28 days ago
You can definitely use it as an incredibly powerful learning tool. I've been using it to guide me through Haskell and I've learned so much more than I did in college when I had spent way more time on it (that time being 10 years ago so I had forgotten most of it). It's invaluable being able to go and ask the AI questions and have it rephrase the parts you don't understand. I spent a good hour with it figuring out exactly what the traverse function does (`traverse (\x -> ['z', x]) "ab"` probably doesn't do what you think it should).

Spoiler: The <> combines lists as cross joins (for-loop within another for-loop). The lambda maps to new lists ['z', 'a'] and ['z', 'b'] (strings are just char arrays). It then computes the various combinations to recombine them so ['z', 'z'], ['z', 'b'], ['a', 'z'], ['a', 'b']. Note it's not all permutations since you don't have ['z', 'a'] even though that's actually one of the "base" arrays we got from the lambda. It took me a long time to really internalize that and it's still probably not a function I'd reach for.

It is kind of cool, though, that you can do `(,) <$> lista <> listb` and you get a nested for loop.

1 comments

I've been getting the most value out of LLMs this way as well. I don't care to vomit out code for the fastest MVP. I want to learn and understand what goes into what I'm building, piece by piece. So I use LLMs as a research and learning assistant to speed up gaining those tidbits. But I still have to understand the code well enough to put the pieces together by hand.