I want to compile my program with profiling, so I run:
$ cabal configure --enable-executable-profiling
...
$ cabal build
...
Could not find module \'Grap
Daniel Fischer's answer looks good, but for some reason my ~/.cabal/world library only contained entries for libraries directly installed, and not their dependencies.
Instead, I dumped out a list of all installed libraries using
$ ghc-pkg list > list
This lists the libraries installed system-wide and locally. Therefore, I edited the list file to remove the first portion (containing libraries installed system-wide) leaving only the lines after /home/. Finally, I ran
$ cabal install --reinstall $(cat list)
This worked for me. You should maybe do --dry-run first. Then go make a pot of tea. Or bake a cake.