cabal install --root-cmd=sudo --global cabal-install
That way, cabal will only acquire root privileges for the
installation. It does not need to run as root for the entire
downloading, building, etc. process, and in fact doing so can be bad,
since it pollutes your package cache with files owned by root, leading
to potential permissions problems in the future.