3 ms·
This defaults Num, Read, and Show to Integer—I try to avoid defaulting because it’s kind of a language wart. And speaking of golf: same length but one fewer imp
by evincarofautumn 14y ago
This defaults Num, Read, and Show to Integer—I try to avoid defaulting because it’s kind of a language wart. And speaking of golf: same length but one fewer import by killing the fmap.
print . sum . map read . lines =<< readFile "somefile.txt"
- tome 14y agoMuch clearer. I slightly prefer the following though: ((print . sum . map read . lines) <=< readFile) "somefile.txt"
- evincarofautumn 14y agoPointfree makes more sense for a definition, I think: sumFileLines = print . sum . map read . lines <=< readFile Less so inline because of the excessive parentheses or ($).