Hacker News new | past | comments | ask | show | jobs | submit login

I agree with your intuition. I'll try to make my intuition explicit:

The 'splittee' should be the last argument. The last argument is usually what you want to a) elide as part of function composition, or b) loop over (the tightest).

E.g. Splitting a file into lines:

    lines content = splitBy "\n" content
can be:

    lines = splitBy "\n"
If splitBy used the other order, it would be:

    lines = (\c -> splitBy c "\n")
E.g. Splitting a file by lines and tabs:

    entries content = concatMap splitBy "\t" (splitBy "\n" content)
can be:

    entries = concatMap splitBy "\t" . splitBy "\n"
If splitBy used the other order, it would be:

    entries content = concatMap splitBy (splitBy content "\n") "\t"



Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: