GHC 7.8 compatibility

Allows building with GHC 7.8. Fixes issue #979.

Some `-Werror`s may remain; this is only for the build system.