Please, who knows of any practicable way to apply ghc -c -cpp
to the programs containing quotations? For (') is very usual symbol
in Haskell, and it appears a special symbol in cpp. For example,
#define C Cons'
data List' a = Nil' | Cons' a (List' a)
f' (C x) = case g x of x' -> x:x'
It looks like cpp expects (') to be closed by another ('), otherwise
it is a cpp error.
Simon Marlow <[EMAIL PROTECTED]> writes
> I misunderstood the problem. This should work:
>
> #define C CRP
> data R a = CRP a
> f (C x) = x
> f'{-'-} (C x) = x
>
> I often have to do this sort of thing so that emacs gets the colors right
> :-)
Thank you, this is some explanation. The problem remains, though.
I used #define to make the program more readable.
For example, the global data constructor is CRP - a shorthand for
Constant Recursive Polynomial. It is not good to call it C globally,
because too many things can be associated with `C' by the user program.
But locally, for the given module that contains many CRP, CRP' names,
and such, i used #define C CRP
to improve readability: this makes CRP-s look like C.
Now, (') spoils everything. Following your technique, each (') causes
extra {-'-}.
So #define & -cpp have made the program look worse that it was.
Hence, using the #define shorthands, mind (') and avoid it as possible
- right ?
Another point.
All the modules of my program are processed by ghc -c -cpp.
About 5 of them really use cpp - only to #define shorthands.
The modules contain many-many ' symbols, and i never knew, it is
special in cpp and that this {-'-} trick is neccessary (i know almost
nothing on cpp).
The program always worked - until this last case with C - CRP.
But it appears that according to cpp, it was always full of errors.
This is why i talked of "panic".
Maybe, cpp does report errors, and ghc improves or ignores them?
Can ghc improve cpp - to support the Haskell nature of (') ?
------------------
Sergey Mechveliani
[EMAIL PROTECTED]