[Haskell-cafe] Re: ghc6.8: hiding uninstalled package?

Ben Franksen ben.franksen at online.de
Tue Jan 22 14:57:32 EST 2008

Magnus Therning wrote:
> I stumbled on this behaviour because I was writing a
> makefile
> for my unit/quickcheck tests.  I need to make sure that the correct module
> is used, hence I need to hide it if it's installed.  I ended up with the
> following in order to work around the issue:
> ifeq (,$(shell ghc-pkg list dataenc | grep dataenc))
> GHCOPTS = -fhpc -isrc
> else
> GHCOPTS = -fhpc -hide-package dataenc -isrc
> endif
> % : %.hs
>         ghc --make $(GHCOPTS) $<
> Is there a better way to do it?

The 'ghc-pkg list dataenc | grep dataenc' cannot be avoided AFAIK. Using
some make-fu you can avoid the conditional, though, thus making it a bit
more generic:

PACKAGES_TO_HIDE := bla mtl blub base

 $(foreach p,$(PACKAGES_TO_HIDE), $(shell ghc-pkg list $p | grep $p))




More information about the Haskell-Cafe mailing list