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 EXISTING_PACKAGES_TO_HIDE :=\ $(foreach p,$(PACKAGES_TO_HIDE), $(shell ghc-pkg list $p | grep $p)) GHC_HIDE_PACKAGE_OPTS = $(EXISTING_PACKAGES_TO_HIDE:%=-hide-package %) GHCOPTS = -fhpc -isrc $(GHC_HIDE_PACKAGE_OPTS) Cheers Ben _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
