more type-stable reductions (fix #6069)
Merge pull request #6116 from stevengj/stablereduce

more type-stable reductions