[Haskell-cafe] Re: Allowing hyphens in identifiers
Richard O'Keefe
ok at cs.otago.ac.nz
Wed Dec 9 20:21:57 EST 2009
On Dec 10, 2009, at 12:05 PM, Deniz Dogan wrote:
> 2009/12/9 Richard O'Keefe <ok at cs.otago.ac.nz>:
>>
>> Here is such a preprocessor. This is meant for people to try out.
>> I don't claim that it's perfect, it's just a quick hack.
>>
>
> Is there any flag I can pass to e.g. GHC to make it use the
> preprocessor automagically or do I write my own little hack to apply
> the preprocessor?
It's amazing what you find in the manual:
-F
runs a custom preprocessor.
Let the source file be $S.
First, literate Haskell processing is done,
producing $L.
Then <your program> "$S" "$L" "$O" is run,
where $O is where GHC wants your program to
write its output.
GHC then reads $O.
-pgmF cmd
tells GHC to use cmd as the custom preprocessor.
My little hspp was written before I realised this could be done,
so I had to whip up
#!/bin/sh
exec hspp <"$2" >"$3"
and use that.
Sample session:
m% cat main.hs
main = print (take-while (<10) [1..])
m% ghc -F -pgmF hspp.sh main.hs
m% a.out
[1,2,3,4,5,6,7,8,9]
If there isn't a GHC option to count the dragons in the moon,
there soon will be.
One option that would be nice would be accepting -help as well
as --help.
More information about the Haskell-Cafe
mailing list