Revert "Many minor fixes to get things building after recent compiler changes".

This reverts the Haskell part of commit 326ca0f6900142b1, because these changes
broke the 'scientific' build with GHC 7.4.2.