Standalone deriving wibbles: keyword is 'derive' not 'derived'; and add flag document...
authorsimonpj@microsoft.com <unknown>
Tue, 2 Jan 2007 16:17:52 +0000 (16:17 +0000)
committersimonpj@microsoft.com <unknown>
Tue, 2 Jan 2007 16:17:52 +0000 (16:17 +0000)
compiler/parser/Lexer.x
compiler/parser/Parser.y.pp
docs/users_guide/glasgow_exts.xml

index 316f21f..bb0fc1e 100644 (file)
@@ -389,7 +389,7 @@ data Token
   | ITdata
   | ITdefault
   | ITderiving
-  | ITderived
+  | ITderive
   | ITdo
   | ITelse
   | IThiding
@@ -544,7 +544,7 @@ isSpecial :: Token -> Bool
 -- not as a keyword.
 isSpecial ITas         = True
 isSpecial IThiding     = True
-isSpecial ITderived            = True
+isSpecial ITderive     = True
 isSpecial ITqualified  = True
 isSpecial ITforall     = True
 isSpecial ITexport     = True
@@ -576,7 +576,7 @@ reservedWordsFM = listToUFM $
        ( "data",       ITdata,         0 ),     
        ( "default",    ITdefault,      0 ),  
        ( "deriving",   ITderiving,     0 ), 
-       ( "derived",    ITderived,      0 ), 
+       ( "derive",     ITderive,       0 ), 
        ( "do",         ITdo,           0 ),       
        ( "else",       ITelse,         0 ),     
        ( "hiding",     IThiding,       0 ),
index 889e4ce..060eeac 100644 (file)
@@ -178,7 +178,7 @@ incorrect.
  'data'        { L _ ITdata } 
  'default'     { L _ ITdefault }
  'deriving'    { L _ ITderiving }
- 'derived'     { L _ ITderived }
+ 'derive'      { L _ ITderive }
  'do'          { L _ ITdo }
  'else'        { L _ ITelse }
  'hiding'      { L _ IThiding }
@@ -740,7 +740,7 @@ tycl_hdr :: { Located (LHsContext RdrName,
 
 -- Glasgow extension: stand-alone deriving declarations
 stand_alone_deriving :: { LDerivDecl RdrName }
-       : 'derived' 'instance' inst_type {% checkDerivDecl (LL (DerivDecl $3)) }
+       : 'derive' 'instance' inst_type {% checkDerivDecl (LL (DerivDecl $3)) }
 
 -----------------------------------------------------------------------------
 -- Nested declarations
@@ -1738,7 +1738,7 @@ special_id
        : 'as'                  { L1 FSLIT("as") }
        | 'qualified'           { L1 FSLIT("qualified") }
        | 'hiding'              { L1 FSLIT("hiding") }
-       | 'derived'             { L1 FSLIT("derived") }
+       | 'derive'              { L1 FSLIT("derive") }
        | 'export'              { L1 FSLIT("export") }
        | 'label'               { L1 FSLIT("label")  }
        | 'dynamic'             { L1 FSLIT("dynamic") }
index 29e7082..41bba18 100644 (file)
@@ -2069,7 +2069,7 @@ the standard method is used or the one described here.)
 <title>Stand-alone deriving declarations</title>
 
 <para>
-GHC now allows stand-alone <literal>deriving</literal> declarations:
+GHC now allows stand-alone <literal>deriving</literal> declarations, enabled by <literal>-fglasgow-exts</literal>:
 <programlisting>
   data Foo a = Bar a | Baz String