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

> Maybe because I haven’t used languages like these in the past [...]

Yes, that definitely the case.

If you know what each function above does, including the function composition dot (.), then this is like reading English — assuming you know how to read English.



The “map read” part is what’s off. I think it’s because parens are optional or not required.

There are other languages which are functional as well. like the one in the article and like Elixir where readability is it sacrificed.

I still think readability is atrocious in this language. Sure I can get used to it, but I’d never want to subject myself to that


Parenthesis are not really optional, they're just used differently than other languages. Other languages use parenthesis for function application and grouping, in Haskell it's just grouping.

    wordsPerLine = filter (>0) . map (length . words) . lines
Funnily enough, parenthesis are actually optional in Elixir, although it's a warning to use pipe syntax without them. The following is valid in both Haskell and Elixer:

    length [1,2,3]


Whenever you see something like

  apply foo bar (lol wat)
in Haskell, and it confuses you, simply mentally replace it with

  apply(foo, bar, lol(wat))
To translate into a more popular syntax (e.g. JavaScript).


Problem solved:

    strSum = sum . parsed . words
             where
                parsed = map read




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: