Easy way to remove unwanted/broken Haskell packages (Cabal is not a package manager, remember?)

Managing Haskell libraries/packages is a huge PITA, because you can’t easily resolve dependencies, can’t easily delete old/broken versions of packages, simply because Cabal is not a package manager. This sucks, that’s why every now and then what I have to do is to purge all my conflicting packages, and here is the easiest way to do it:

ghc-pkg check --simple-output | xargs -n 1 ghc-pkg unregister --force

After that you can simply cabal install any package you need.