syntax across languages

Malcolm Wallace Malcolm.Wallace@cs.york.ac.uk
Tue, 12 Feb 2002 14:43:22 +0000


> Being able to specify the extensions required in a source file would be very
> useful in a range of cases. Very often helping other people with Haskell (in
> the case where they are trying to use someone else's module) is just a
> question of saying "try '-98'" or "try '-fglasgow-exts'" or whatever.

ghc and nhc98 already support this.  ghc's mechanism is
    {-# OPTIONS -fglasgow-exts ... etc #-}
at the top of the file - but there are quite a few restrictions on
what flags are accepted in that pragma.  nhc98's mechanism is
    {-# OPTIONS_COMPILE -nkpat ... etc #-}
anywhere in the file, which has no restrictions on the options it
accepts - you can use anything that can appear on the commandline.

Incidentally, nhc98 also recognises the form
    {-# OPTIONS_LINK -L/usr/local/lib -lreadline ... etc #-}
for extra link options, which are accumulated from all modules
specified on the commandline.

Regards,
    Malcolm