FWIW, with folly::gen [1], this is just:
using namespace folly::gen;
byLine('/a/file/with/numbers') | eachTo<int> | sum;
https://github.com/facebook/folly/tree/master/folly/gen