When installing inside a cabal sandbox, cabal will still use packages from the global package db (in particular, packages which came from the Haskell Platform). This can lead to
You should be able to pass cabal configure
the --package-db
flag, documented like so:
--package-db=DB Append the given package database to the list of package databases used (to satisfy dependencies and register into). May be a specific file, 'global' or 'user'. The initial list is ['global'], ['global', 'user'], or ['global', $sandbox], depending on context. Use 'clear' to reset the list to empty. See the user guide for details.
So in particular, you can pass it clear
and then pass it just the sandbox db.
This is all discussed in wonderful detail in the Storage and Interpretation of Cabalized Packages article.