$ ghc-pkg check --package-db=~/cabal
ghc-pkg: ~/cabal: openFile: does not exist (No such file or directory)
$ ls ~/cabal
package.cache
Yet another reason to avoid ~... it's (a) only expanded by the shell, and (b) not reliably expanded even by the shell if it's not the very start of a word (as here where it is after =). Use $HOME instead.