proposal about declaring language version and language extensions used in specific module
Hello all. i have a proposal about declaring language version and language extensions used in specific module PROBLEM: 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 pragma/comment SOLUTION: 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 backward-compatible 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@HotPOP.com
I thought there was talk of a standardized {-# LANGUAGE ... #-} pragma somewhere.. but I can't seem to find it. John -- John Meacham - ⑆repetae.net⑆john⑈
On Tue, Aug 09, 2005 at 03:37:01PM -0700, John Meacham wrote:
I thought there was talk of a standardized {-# LANGUAGE ... #-} pragma somewhere.. but I can't seem to find it.
http://www.haskell.org//pipermail/haskell/2003-September/012692.html http://www.haskell.org//pipermail/libraries/2004-October/002589.html The latter version is also mentioned in the Cabal User's Guide under the "extensions" field, but it only works for Hugs at present.
Hello Ross, Wednesday, August 10, 2005, 4:24:53 AM, you wrote: RP> On Tue, Aug 09, 2005 at 03:37:01PM -0700, John Meacham wrote:
I thought there was talk of a standardized {-# LANGUAGE ... #-} pragma somewhere.. but I can't seem to find it.
RP> http://www.haskell.org//pipermail/haskell/2003-September/012692.html RP> http://www.haskell.org//pipermail/libraries/2004-October/002589.html of course, my proposed extension is very trivial. but compared to above mentioned variants, it moves definition of language used in module from pseudocomments to language itself. i also propose moving of all pragmas from pseudocomments to special language statements -- Best regards, Bulat mailto:bulatz@HotPOP.com
participants (3)
-
Bulat Ziganshin -
John Meacham -
Ross Paterson