Updated to work with GHC HEAD and modern cabal