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

I’m not familiar with Haskell and I could read almost all of that from it. No idea how you can tell it splits on white space though.


I guess the more succinct the code, the more the reliance on understanding what a function actually does - either through experience, or by reading the docs. The words function is simply:

  words :: String -> [String]
So that

  words "foo bar baz"
  -- Produces: ["foo","bar","baz"]
In my experience, both the blessing and the curse of Haskell's incredible succinct expressiveness is that, like other specialised languages - for example using latin for succinctly-expressed legal terms - you need a strong understanding of the language and its standard library - similar to the library of commonly used "legal terms" in law circles - to participate meaningfully.

Haskell, and languages like Go (which anybody with a bit of programming experience can easily follow) have very different goals.

Like many in this discussion, I too have developed a love/hate thing with Haskell. But boy, are the good parts good ...


I recently learned that things like Goroutines aren’t naturally written with buffers and channels. Granted anyone who reads the original documentation would likely do it correctly, but apparently that’s not how they are intuitively written. so while it may be easy to read it might be harder to write than I was assuming.

So maybe there a difference where Haskell has an advantage? I mentioned it in my previous comment but I don’t know Haskell at all, but if this is “the way” to do splits by word then you’ll know both to read and write it. Which would be a strength on its own, since I imagine it would be kind of hard to do wrong since you’ll need that Haskell understanding in the first place.


It all comes down to knowing the FP vocabulary. Most of FP languages share the names of the most widely used functions, and if you're well versed in Haskell you'll have 80/20 ratio of understanding them all, where the 20% part would be language-specific libraries that expand and build upon the 80% of the FP vocabulary.


As a Haskell noob, I had the same problem a few times. Essentially: there's a function to do what you want to do, but good look finding it!

Someone thought "words" was the perfect name, and it wasn't me!


https://hoogle.haskell.org/ can help you find the function that you're looking for.

As for "words"... yes, possibly not the best name. But also so common that everyone that has ever written any Haskell code knows it. Such as Java's System.out.println


not quite as helpful, but this reminded me of: https://wordly.org/wordle-games/haskle "a wordle clone for learning haskell functions"


Yeah this language probably has a lot of Stackoverflow questions. This is basically like tasking someone’s personal dot file and trying to reason about it


Yeah, that's where you just have to know what the "words" function from the standard library does.




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

Search: