type inference
Revert "eh?"

This reverts commit 41095530d5223a86b743cec6a2d1e8f921bcfb7b.
Type declarations
Use built-in sum-over-dimension
Handrolled sum() :-(