updated return types of reduce/foldl/inject