Changes between Version 4 and Version 5 of LanguagePragma


Ignore:
Timestamp:
Aug 20, 2009 2:50:11 AM (6 years ago)
Author:
ravi@…
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • LanguagePragma

    v4 v5  
    1616== Summary == 
    1717 
    18 Document the minimum guarantees provided by the LANGUAGE pragma so that Haskell 2010 users can reliably use it to portable control access to non-Haskell 2010 language features. 
     18Document the minimum guarantees provided by the LANGUAGE pragma. 
    1919 
    2020== Description == 
    2121 
    22 To-be-completed. 
     22GHC and Cabal (via Language.Haskell.Extension) have been successfully using the LANGUAGE pragma for the following two purposes: 
     23 
     241. Document the post-Haskell98 language extensions a source file requires. 
     252. Locally enable those required language extensions when compiling an extension-using source file. 
     26 
     27The goal of this proposal is to specify the minimum guarantees provided LANGUAGE pragma so that it can be used portably for those same purposes across Haskell 2010 implementations. 
    2328 
    2429== References == 
     
    6671'''11.3 Language Extensions''' 
    6772 
    68 <to-be-completed> 
     73The LANGUAGE pragma is a file-header pragma. A file-header pragma must precede the module keyword in a source file. There can be as many file-header pragmas as you please, and they can be preceded or followed by comments. An individual language pragma begins with the keyword LANGUAGE and is followed by a comma-separated list of named language extensions.  
     74 
     75For example, to enable the FFI and preprocessing with CPP: 
     76 
     77{-# LANGUAGE ForeignFunctionInterface, CPP #-} 
     78 
     79If a Haskell implementation does not recognize or support a particular language extension that a source file requests (or cannot support the combination of language extensions requested), any attempt to compile or otherwise use that file with that Haskell implementation must fail with an error. 
     80 
     81In the interests of portability, multiple attempts to enable the same, supported language features (e.g. via command-line arguments, implementation-specific extension dependencies or non-standard pragmas) are specifically permitted.  
     82 
     83Haskell 2010 implementations are required to support {-# LANGUAGE Haskell2010 -#}. {-# LANGUAGE Haskell2010 -#} implies support for the following named language extensions standardized in Haskell 2010 (and recognized by pre-Haskell 2010 compilers): {-# LANGUAGE PatternGuards -#}, {-# LANGUAGE EmptyDataDecls #-}, {-# LANGUAGE ForeignFunctionInterface #-}, ... 
    6984{{{ 
    7085#!html