
You are right that hat-trans and hmake have to agree on the directory structure (although duplicating this information is not nice). Is not the point of the -i option to set the *base* search paths? Such a path should always point to the base of a possibly hierachical namespace. So extending the base with "/Hat" would be correct. This also suggests that hat-trans should always be called with the full hierarchical name of a module. Otherwise hat-trans would need to find out to which hierarchy (given several search paths) the module to be transformed belongs. The guessing method used by hmake and now also by hat-trans based on occurrence of "." or ".." is rather brittle. Ciao, Olaf Malcolm Wallace wrote:
Olaf Chitil
writes: Above it looks like the wrong directory was created. Hat created the directory Hat/../Code when I think it should have created the directory ../Code/Hat.
I agree. The directory Hat should be put at the end of the import path, not at the begining.
The placement of the Hat directory (at the beginning or end of a path) is dependent on how the directory name is to be interpreted. A path corresponding to the hierarchical module namespace, like Code/Pictures/Jpg.hs should become Hat/Code/Pictures/Jpg.hs whereas a mere relative pathname with a flat namespace should be the opposite, e.g. ../Code/Pictures/Jpg.hs becomes ../Code/Pictures/Hat/Jpg.hs
This is a problem with hmake, not with the Hat tools themselves. Malcolm, could you modify hmake accordingly?
Actually, in this instance hmake guessed the directory correctly. The fault was with hat-trans, which simply assumed all paths were strictly hierarchical. The attached patch should fix it.