[Haskell] proposal about declaring language version and language extensions used in specific module

Bulat Ziganshin bulatz at HotPOP.com
Tue Aug 9 09:37:06 EDT 2005

Hello all.

i have a proposal about declaring language version and
language extensions used in specific module

1) Haskell 2.0 may be slightly incompatible with Haskell 98. at least,
new records extension will, afaik, lead to that H'98 (old) programs
can't be compiled with Haskell 2.0 compilers. this will create a
problem if we want to use the same extensions (hs, lhs, chs)
both for Haskell 98 and Haskell 2.0 programs

2) currently language extensions needed to compile specific module are
coded via {-# OPTIONS ... #-} pragma. that is both compiler-specific
and encodes information, essential for compiling module, as some optional

use specific language keyword to declare language version and used
extensions. i will give several examples of this statement: 

haskell 98 with template haskell, implicit parameters
haskell 2.0
haskell 2.0 with generics
haskell 2.1

so, general syntax will be:

"haskell" version ["with" extension [,extension]*]

where version = "98" | "2.0" | ...
      extension = "template haskell" | "implicit parameters" | ...

such statement will declare base language version and additional
extensions to this language version, used in the module. it must be
first statement in the module. if this statement is not given, then
"haskell 98" is supposed

using this statement will give exact meaning to each module, despite
all the future Haskell versions and extensions we will encounter and
will simplify adding new language extensions that is not

ps: as variants of this idea we can standartize OPTIONS and several
other pragmas in the language itself or, better, add new language
keyword to replace these pseudocomments. how about this:

option "haskell 2.0"
option "inline main, sub1, sub2"
option "ghc-rule ..."   -- GHC-specific options starts with "ghc-"

Best regards,
 Bulat                          mailto:bulatz at HotPOP.com

More information about the Haskell mailing list