A Haskell specific preprocessor
I faintly remember that there was once work on a Haskell specific preprocessor. Why was the work abandoned? cpp just annoyed me again. I wrote (/*) = something and cpp complained Test.hs:4: unterminated comment Ciao, Olaf -- OLAF CHITIL, Dept. of Computer Science, The University of York, York YO10 5DD, UK. URL: http://www.cs.york.ac.uk/~olaf/ Tel: +44 1904 434756; Fax: +44 1904 432767
-C option cure it... (that was hugs, wasn't it? I added -Fcpp_hugs to HUGSFLAGS, where cpp_hugs is script which wraps cpp. See the attachment.) Haskell (with "syntactic sugar" rules) is quiet good itself. Cpp is mostly used for "#if" portability triggers, and it's good for the purpose. C-specific things is avoidable by various options. There is also gpp project. I didn't tried it, just read the announce. Maybe you could use it. http://auroux.free.fr/prog/gpp.html The another question is making the desugaring and layout parsing by the separate program(s). I think it would be good. Then, there could be possible to vary syntax by configuration of the preprocessor. There are lot of projects which propose it's own "sugars". Max.
Olaf writes:
I faintly remember that there was once work on a Haskell specific preprocessor. Why was the work abandoned?
I had some ideas, which I put together in a note http://www.cl.cam.ac.uk/~kw217/research/paper-abstracts.html#Wansbrough99:Ma... but most people seemed to believe that a lazy language shouldn't need macros or a preprocessor (despite the liberal use of both in GHC, for example). --KW 8-) -- Keith Wansbrough <kw217@cl.cam.ac.uk> http://www.cl.cam.ac.uk/users/kw217/ University of Cambridge Computer Laboratory.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Friday 11 January 2002 15:04, Keith Wansbrough wrote:
but most people seemed to believe that a lazy language shouldn't need macros or a preprocessor (despite the liberal use of both in GHC, for example).
I'm hoping I will not have to use any sort of macro preprocessor that has survived from 1965. If you need it for platform compatibility switches I would reckon that you can do it at the file level [+]. It looks much nicer, see tcl/tk sources. I can tell from experience that writing a C++ class with #ifdef 's in the middle of the interface is the worst possible kind of coding. [*] I don't see any other reason why someone would want to use a macro preprocessor except accidental habits. Any sort of configuration which does not prevent compilation (i.e. availability of a library), can be implemented in run time. That is probably better/more extensible design as well. Everything else a macro procesor is used for in low/medium level languages like C can be elegantly defined in a higher level language such as Haskell. Thanks, [+] Though I have no idea how you could do that with a Haskell build system, is there something like a VPATH that haskell compiler recognizes? There might be some problems implementing different files for different platforms approach without such a feature. Maybe you could simply symlink the required files into a source dir in a build system and compile there. Might not be very portable to a certain less-than-UNIX system though. :) [*] I try not to use any CPP except #include's in C++. - -- Eray Ozkural (exa) <erayo@cs.bilkent.edu.tr> Comp. Sci. Dept., Bilkent University, Ankara www: http://www.cs.bilkent.edu.tr/~erayo GPG public key fingerprint: 360C 852F 88B0 A745 F31B EA0F 7C07 AE16 874D 539C -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE8Pw7VfAeuFodNU5wRAkSgAJ4lwi+tqeRauZZZpRJXkRl3wPH2pQCdGip7 aGmebPcRSXVTzzedZCXgH6A= =sUuT -----END PGP SIGNATURE-----
participants (4)
-
Eray Ozkural (exa) -
Keith Wansbrough -
Max A.K. -
Olaf Chitil