top | item 42304586

(no title)

bhargav | 1 year ago

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

discuss

order

itishappy|1 year ago

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]

runeks|1 year ago

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).

instig007|1 year ago

Problem solved:

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