Hi,

I am playing with greencard a little bit and failed to compile the
examples in the documentation. I am using ghc-4.01 (4-02 refuses to
compile greencard) and GNU CPP version 2.8.1 (i386 GNU/Linux with ELF).

We I make ghc eat the following code (in module Main with a trivial
main function):

> data Polar = P Int Int deriving Show
>
> polarToCart :: Polar -> (Int, Int)
> polarToCart (P a b) = (a, b)
>
> cartToPolar :: (Int, Int) -> Polar
> cartToPolar (a, b) = P a b
>
> %fun mirror :: Polar -> Polar
> %call (< polarToCart / cartToPolar > (int x) (int y))
> %code x = -x;
> %     y = -y;
> %result (< polarToCart / cartToPolar > (int x) (int y))


the error is this:

> [...]
>
> End of search list.
>  [...]/2.8.1/cc1 /tmp/cca32238.i -quiet -dumpbase ghc32227.c -O -Wimplicit -version 
>-fomit-frame-pointer -fno-defer-pop -o ghc32227.s
> GNU C version 2.8.1 (i586-pc-linux-gnu) compiled by GNU C version 2.8.1.
> /tmp/ghc32227.hc:479: redeclaration of `x'
> /tmp/ghc32227.hc:479: `x' previously declared here
> /tmp/ghc32227.hc:479: redeclaration of `y'
> /tmp/ghc32227.hc:479: `y' previously declared here


Is this a problem with gcc? Or should I use ghc3 instead of 4? Also, I
did not figure out how to keep ghc from ignoring the
``-keep-hc-file-too option''. Is it because the hc file is corrupted
that ghc does not want me to look at it?

I would really like to get this running, the greencard idea looks very
convenient.

thanks for any hints,

 -Matthias




(Btw, does anybody know why ghc4.02 complains about comments starting
with a character different from space (like in ``--:: type'')? This is
certainly not intended, is it?)

Reply via email to