On 1/17/08, <b class="gmail_sendername">Albert Y. C. Lai</b> <<a href="mailto:trebla@vex.net">trebla@vex.net</a>> wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Magnus Therning wrote:<br>> This might seem like a silly question, but what's the reasoning behind<br>> the following behaviour?<br>><br>> % ghc-pkg list dataenc<br>> /usr/lib/ghc-6.8.2/package.conf:<br>
> % ghc --make -hide-package dataenc -isrc UT.hs<br>> ghc-6.8.2 : unknown package: dataenc<br>><br>> Hiding an uninstalled package doesn't seem to warrant failing compilation!<br><br>"I cannot find it, therefore I cannot hide it"? XD
<br><br>The following is fairly widely accepted behaviour:<br><br>$ rm phd-thsies<br>rm: cannot remove `phd-thsies': No such file or directory<br><br>If a file is absent and you want it absent, is that an error?<br><br>
(Now you might get into a long thread debating whether deletion is<br>analogous to hiding...)<br><br>If I want to hide or delete something, and the computer can't find that<br>something, it may be because I have a typo. If the computer remains
<br>silent about it, I fail to hide or delete the true thing. I want to<br>delete phd-thesis, but I typed phd-thsies, and I appreciate the error<br>report. If I fail to delete phd-thesis, at worst more people read it and<br>
be enlightened :) but if I fail to hide a package and I don't know about<br>it, the ensuing problems will be much more mysterious.</blockquote><div><br>Fair enough. 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:
<br><br>ifeq (,$(shell ghc-pkg list dataenc | grep dataenc))<br>GHCOPTS = -fhpc -isrc<br>else<br>GHCOPTS = -fhpc -hide-package dataenc -isrc<br>endif<br><br>% : %.hs<br> ghc --make $(GHCOPTS) $<<br><br>Is there a better way to do it?
<br><br>/M<br></div></div>