
This one had me puzzled for a few seconds before I spotted what was going on! $ rm foo*; touch foo.hs foo.lhs; hmake foo.lhs nhc98 -c -o foo.o foo.hs Warning: Can not find main in module Main. Thanks Ian

This one had me puzzled for a few seconds before I spotted what was going on!
$ rm foo*; touch foo.hs foo.lhs; hmake foo.lhs nhc98 -c -o foo.o foo.hs
Well, having both foo.hs and foo.lhs in the same directory is a somewhat dangerous thing. However, if you are (for instance) generating the .hs automatically from the .lhs using some kind of un-literating tool, then it might make some sense. But in that case, it would not matter which file was actually compiled... In any case, you can change hmake to prefer a .lhs over a .hs with the following patch. Regards, Malcolm Index: src/hmake/GetDep.hs =================================================================== RCS file: /usr/src/master/nhc/src/hmake/GetDep.hs,v retrieving revision 1.6 diff -u -r1.6 GetDep.hs --- src/hmake/GetDep.hs 2001/03/22 18:45:29 1.6 +++ src/hmake/GetDep.hs 2001/12/17 11:45:17 @@ -134,8 +134,8 @@ readFile s >>= \file-> readData p s (f file) else try xs in try [ (fixFile opts p ff "gc", id), - (fixFile opts p ff "hs", id), - (fixFile opts p ff "lhs", (unlit name))] + (fixFile opts p ff "lhs", (unlit name)), + (fixFile opts p ff "hs", id)] rP [] = error ("Can't find module "++name++" in\n\t"++ concat (intersperse "\n\t" (".":pathSrc opts))++

On Mon, Dec 17, 2001 at 11:46:05AM +0000, Malcolm Wallace wrote:
This one had me puzzled for a few seconds before I spotted what was going on!
$ rm foo*; touch foo.hs foo.lhs; hmake foo.lhs nhc98 -c -o foo.o foo.hs
In any case, you can change hmake to prefer a .lhs over a .hs with the following patch.
Clearly one must be preferred if you type "hmake foo", but when an extension is explicitly given hmake should compile that file. Thanks Ian

In any case, you can change hmake to prefer a .lhs over a .hs
Clearly one must be preferred if you type "hmake foo", but when an extension is explicitly given hmake should compile that file.
That would seem sensible. However, because of the way hmake is structured, it would be a largish change, so I won't be doing it today. It will go on the "to do" list. Regards, Malcolm
participants (2)
-
Ian Lynagh
-
Malcolm Wallace