hat, ghc

Frederik Eaton frederik at a5.repetae.net
Thu Sep 1 16:34:30 EDT 2005


On Thu, Sep 01, 2005 at 04:46:38PM +0100, Malcolm Wallace wrote:
> Frederik Eaton <frederik at a5.repetae.net> writes:
> 
> > Is there a way to use Hat with GHC, without 'hmake'?
> 
> You could transform each module in your project individually with
> hat-trans, before running ghc --make over the traced version.
> Unfortunately, this means you will need to find some other way to
> do the dependency analysis to ensure that modules are transformed
> in the right order.  It is a known deficiency of the ghc --make
> implementation that it cannot handle pre-processors nicely - this
> applies equally to Happy, Alex, generic Haskell, etc.
> 
> One way would be to write a Makefile, with rules something like
> 
>     $(patsubst %.hs, Hat/%.hs, ${SRCS}) : Hat/%.hs : %.hs
> 		hat-trans $<
>     $(patsubst %.hs, Hat/%.o, ${SRCS}) : Hat/$.o : Hat/%.hs
> 		ghc -c -package hat $<
> 
> and then use ghc -M to generate the dependencies somehow.

OK, I might try that.

> ...
> > i.e., I'm not sure how 'hmake' found /usr/lib/ghc-6.2.2, but this
> > directory is not mentioned in my environment, and it was not my
> > intention to use this version of ghc.
> 
> You can select which version of ghc is used by hmake, either on the
> command-line, or by setting a default with hmake-config.  e.g.
>     hmake -hc=/home/frederik/.toast-i386/armed/bin/ghc ...
> or
>     hmake-config list
>     hmake-config add /home/frederik/.toast-i386/armed/bin/ghc
>     hmake-config default /home/frederik/.toast-i386/armed/bin/ghc

By the way, can I make a request to have the hmake default be to use
the environment? I have to have my environment correctly configured
anyway, to get other things to work, and hmake isn't saving me any
trouble by asking me to duplicate this information in a different
form.

Now, it appears to be looking for 'ghc-pkg' in the library directory
of 'ghc' (rather, again, than in $PATH)

$ hmake-config add /home/frederik/.toast-i386/armed/bin/ghc
$ hmake-config default /home/frederik/.toast-i386/armed/bin/ghc
$ hmake -ghc -hat pointtracker.hs
sh: /home/frederik/.toast-i386/armed/lib/ghc-6.4.1.20050812/bin/ghc-pkg: No such file or directory

Fail: user error (Command (/home/frederik/.toast-i386/armed/lib/ghc-6.4.1.20050812/bin/ghc-pkg -l) failed)

Stop - hmake dependency error.
[1]$ which ghc-pkg
/home/frederik/.toast-i386/armed/bin/ghc-pkg

Frederik

-- 
http://ofb.net/~frederik/


More information about the Glasgow-haskell-users mailing list