
Henrik Nilsson
I believe a scheme like this would make it simpler to write code that works across different Haskell system even in cases where it is necessary to give special instructions to the compiler on a per-file basis. Specifically, such a scheme would
* encourage the standardization of the syntax and semantics for "important" command-line options
I think Simon was suggesting the pragma {-# LANGUAGE ... #-} for a compiler-independent specification of the specific language extensions required by a module - this could indeed be in a format derived from Cabal. However, in the meantime, {-# OPTIONS[-xHC] ... #-} already exists, and is a less-rigorous means to the same end, since it often uses stuff like "-cpp", "-ffi", "-puns", whatever, but compiler-specific.
* reduce the needs for #ifdefs.
I don't see how the use of pragmas will directly reduce the need for conditional imports. Eventually, the libraries shipped with compilers will converge sufficiently to reduce differences in imports, but that is a separate issue.
{-# OPTIONS_COMPILE ... #-} {-# OPTIONS_LINK ... #-}
Could you elaborate on this, please? E.g. through some examples. What kind of link options do you have in mind? Are they independent of the Haskell system and operating system, or might they depend on either or both?
I was thinking for instance of an FFI binding to an external library. E.g. {-# OPTIONS_COMPILE `glib-config --cflags` #-} {-# OPTIONS_LINK `glib-config --libs` #-} module Glib where ... The idea was to help 'hmake'. Only the binding module needs to know about what extra linking options (e.g. -lglib -L/pkg/glib) are required, yet when a program that /uses/ the module is built, we must still discover these extra dependencies. However, I am willing to be convinced that this extra mechanism is unnecessary, especially in view of the more recent emergence of the 'package' mechanism, which can neatly encapsulate exactly this kind of detail. Regards, Malcolm