[de-literate happy parser source
John Meacham <john@repetae.net>**20061109105246] move ./FrontEnd/HsParser.ly ./FrontEnd/HsParser.y
hunk ./FrontEnd/HsParser.y 1
------------------------------------------------------------------------------
-$Id: HsParser.ly,v 1.4 2001/11/25 08:52:13 bjpop Exp $
+-- -----------------------------------------------------------------------------
+-- $Id: HsParser.ly,v 1.4 2001/11/25 08:52:13 bjpop Exp $
hunk ./FrontEnd/HsParser.y 4
-(c) Simon Marlow, Sven Panne 1997-2000
-Modified by John Meacham
+-- (c) Simon Marlow, Sven Panne 1997-2000
+-- Modified by John Meacham
hunk ./FrontEnd/HsParser.y 7
-Haskell grammar.
------------------------------------------------------------------------------
+-- Haskell grammar.
+-- -----------------------------------------------------------------------------
hunk ./FrontEnd/HsParser.y 10
-ToDo: Is (,) valid as exports? We don't allow it.
-ToDo: Check exactly which names must be qualified with Prelude (commas and friends)
-ToDo: Inst (MPCs?)
-ToDo: Polish constr a bit
-ToDo: Ugly: infixexp is used for lhs, pat, exp0, ...
-ToDo: Differentiate between record updates and labeled construction.
+-- ToDo: Is (,) valid as exports? We don't allow it.
+-- ToDo: Check exactly which names must be qualified with Prelude (commas and friends)
+-- ToDo: Inst (MPCs?)
+-- ToDo: Polish constr a bit
+-- ToDo: Ugly: infixexp is used for lhs, pat, exp0, ...
+-- ToDo: Differentiate between record updates and labeled construction.
hunk ./FrontEnd/HsParser.y 17
-> {
-> module FrontEnd.HsParser (parse, parseHsStmt) where
->
-> import C.FFI
-> import HsSyn
-> import FrontEnd.ParseMonad
-> import FrontEnd.Lexer
-> import FrontEnd.ParseUtils hiding(readInteger,readRational)
-> import FrontEnd.SrcLoc
->
->
->
-> }
+{
+module FrontEnd.HsParser (parse, parseHsStmt) where
hunk ./FrontEnd/HsParser.y 20
------------------------------------------------------------------------------
-Conflicts: 10 shift/reduce
+import C.FFI
+import HsSyn
+import FrontEnd.ParseMonad
+import FrontEnd.Lexer
+import FrontEnd.ParseUtils hiding(readInteger,readRational)
+import FrontEnd.SrcLoc
hunk ./FrontEnd/HsParser.y 27
-7 for abiguity in 'if x then y else z + 1'
-	(shift parses as 'if x then y else (z + 1)', as per longest-parse rule)
-1 for ambiguity in 'if x then y else z :: T'
-	(shift parses as 'if x then y else (z :: T)', as per longest-parse rule)
-2 for ambiguity in 'case x of y :: a -> b'
-	(don't know whether to reduce 'a' as a btype or shift the '->'.
-	 conclusion:  bogus expression anyway, doesn't matter)
hunk ./FrontEnd/HsParser.y 28
------------------------------------------------------------------------------
hunk ./FrontEnd/HsParser.y 29
-> %token
->	VARID 	 { VarId $$ }
->	QVARID 	 { QVarId $$ }
->	CONID	 { ConId $$ }
->	QCONID   { QConId $$ }
->	VARSYM	 { VarSym $$ }
->	CONSYM	 { ConSym $$ }
->	QVARSYM	 { QVarSym $$ }
->	QCONSYM  { QConSym $$ }
->	INT	 { IntTok $$ }
->	RATIONAL { FloatTok $$ }
->	CHAR	 { Character $$ }
->	STRING   { StringTok $$ }
->       PRAGMAOPTIONS { PragmaOptions $$ }
->       PRAGMASTART { PragmaStart $$ }
->       PRAGMARULES { PragmaRules $$ }
->       PRAGMASPECIALIZE { PragmaSpecialize $$ }
->       PRAGMAEND { PragmaEnd }
+}
hunk ./FrontEnd/HsParser.y 31
-Symbols
+-- -----------------------------------------------------------------------------
+-- Conflicts: 10 shift/reduce
hunk ./FrontEnd/HsParser.y 34
->	'('	{ LeftParen }
->	')'	{ RightParen }
->	'(#'	{ LeftUParen }
->	'#)'	{ RightUParen }
->	';'	{ SemiColon }
->	'{'	{ LeftCurly }
->	'}'	{ RightCurly }
->	vccurly { VRightCurly }			-- a virtual close brace
->	'['	{ LeftSquare }
->	']'	{ RightSquare }
->  	','	{ Comma }
->	'_'	{ Underscore }
->	'`'	{ BackQuote }
+-- 7 for abiguity in 'if x then y else z + 1'
+--      (shift parses as 'if x then y else (z + 1)', as per longest-parse rule)
+-- 1 for ambiguity in 'if x then y else z :: T'
+--      (shift parses as 'if x then y else (z :: T)', as per longest-parse rule)
+-- 2 for ambiguity in 'case x of y :: a -> b'
+--      (don't know whether to reduce 'a' as a btype or shift the '->'.
+--       conclusion:  bogus expression anyway, doesn't matter)
hunk ./FrontEnd/HsParser.y 42
-Reserved operators
+-- -----------------------------------------------------------------------------
hunk ./FrontEnd/HsParser.y 44
->	'..'	{ DotDot }
->	'::'	{ DoubleColon }
->	'='	{ Equals }
->	'\\'	{ Backslash }
->	'|'	{ Bar }
->	'<-'	{ LeftArrow }
->	'->'	{ RightArrow }
->	'@'	{ At }
->	'~'	{ Tilde }
->	'=>'	{ DoubleArrow }
->	'-'	{ Minus }
->	'!'	{ Exclamation }
->	'*'	{ Star }
->	'.'	{ Dot }
+%token
+      VARID    { VarId $$ }
+      QVARID   { QVarId $$ }
+      CONID    { ConId $$ }
+      QCONID   { QConId $$ }
+      VARSYM   { VarSym $$ }
+      CONSYM   { ConSym $$ }
+      QVARSYM  { QVarSym $$ }
+      QCONSYM  { QConSym $$ }
+      INT      { IntTok $$ }
+      RATIONAL { FloatTok $$ }
+      CHAR     { Character $$ }
+      STRING   { StringTok $$ }
+      PRAGMAOPTIONS { PragmaOptions $$ }
+      PRAGMASTART { PragmaStart $$ }
+      PRAGMARULES { PragmaRules $$ }
+      PRAGMASPECIALIZE { PragmaSpecialize $$ }
+      PRAGMAEND { PragmaEnd }
hunk ./FrontEnd/HsParser.y 63
-Reserved Ids
+-- Symbols
hunk ./FrontEnd/HsParser.y 65
->	'as'		{ KW_As }
->	'case'		{ KW_Case }
->	'class'		{ KW_Class }
->	'data'		{ KW_Data }
->	'default'	{ KW_Default }
->	'deriving'	{ KW_Deriving }
->	'do'		{ KW_Do }
->	'else'		{ KW_Else }
->       'export'        { KW_Export }
->	'hiding'	{ KW_Hiding }
->	'if'		{ KW_If }
->	'import'	{ KW_Import }
->	'in'		{ KW_In }
->	'infix'		{ KW_Infix }
->	'infixl'	{ KW_InfixL }
->	'infixr'	{ KW_InfixR }
->	'instance'	{ KW_Instance }
->	'let'		{ KW_Let }
->	'module'	{ KW_Module }
->	'newtype'	{ KW_NewType }
->	'of'		{ KW_Of }
->	'then'		{ KW_Then }
->	'type'		{ KW_Type }
->	'where'		{ KW_Where }
->	'qualified'	{ KW_Qualified }
->	'foreign'	{ KW_Foreign }
->       'safe'          { KW_Safe }
->       'unsafe'        { KW_Unsafe }
->       'ccall'         { KW_CCall }
->       'stdcall'       { KW_Stdcall }
->       'primitive'     { KW_Primitive }
->	'forall'	{ KW_Forall }
->	'exists'	{ KW_Exists }
+      '('     { LeftParen }
+      ')'     { RightParen }
+      '(#'    { LeftUParen }
+      '#)'    { RightUParen }
+      ';'     { SemiColon }
+      '{'     { LeftCurly }
+      '}'     { RightCurly }
+      vccurly { VRightCurly }                 -- a virtual close brace
+      '['     { LeftSquare }
+      ']'     { RightSquare }
+      ','     { Comma }
+      '_'     { Underscore }
+      '`'     { BackQuote }
hunk ./FrontEnd/HsParser.y 79
-> %monad { P } { thenP } { returnP }
-> %lexer { lexer } { EOF }
-> %name parse module
-> %name parseHsStmt qual
-> %tokentype { Token }
-> %%
+-- Reserved operators
hunk ./FrontEnd/HsParser.y 81
------------------------------------------------------------------------------
-Module Header
-> module :: { HsModule }
->       : srcloc modulep                  { $2 { hsModuleSrcLoc = $1, hsModuleOptions = [] } }
->       | srcloc PRAGMAOPTIONS module     { $3 { hsModuleSrcLoc = $1, hsModuleOptions = hsModuleOptions $3 ++ $2 } }
+      '..'    { DotDot }
+      '::'    { DoubleColon }
+      '='     { Equals }
+      '\\'    { Backslash }
+      '|'     { Bar }
+      '<-'    { LeftArrow }
+      '->'    { RightArrow }
+      '@'     { At }
+      '~'     { Tilde }
+      '=>'    { DoubleArrow }
+      '-'     { Minus }
+      '!'     { Exclamation }
+      '*'     { Star }
+      '.'     { Dot }
hunk ./FrontEnd/HsParser.y 96
-> modulep  :: { HsModule }
-> 	: 'module' modid maybeexports 'where' body	{ HsModule { hsModuleName = $2, hsModuleExports = $3, hsModuleImports = (fst $5), hsModuleDecls = (snd $5) } }
->	| body						{ HsModule { hsModuleName = main_mod, hsModuleExports = Just [HsEVar (UnQual (HsIdent "main"))], hsModuleImports = (fst $1), hsModuleDecls = (snd $1) } }
+-- Reserved Ids
hunk ./FrontEnd/HsParser.y 98
-> body :: { ([HsImportDecl],[HsDecl]) }
->	:  '{' bodyaux '}'				{ $2 }
-> 	|      layout_on  bodyaux close			{ $2 }
+      'as'            { KW_As }
+      'case'          { KW_Case }
+      'class'         { KW_Class }
+      'data'          { KW_Data }
+      'default'       { KW_Default }
+      'deriving'      { KW_Deriving }
+      'do'            { KW_Do }
+      'else'          { KW_Else }
+      'export'        { KW_Export }
+      'hiding'        { KW_Hiding }
+      'if'            { KW_If }
+      'import'        { KW_Import }
+      'in'            { KW_In }
+      'infix'         { KW_Infix }
+      'infixl'        { KW_InfixL }
+      'infixr'        { KW_InfixR }
+      'instance'      { KW_Instance }
+      'let'           { KW_Let }
+      'module'        { KW_Module }
+      'newtype'       { KW_NewType }
+      'of'            { KW_Of }
+      'then'          { KW_Then }
+      'type'          { KW_Type }
+      'where'         { KW_Where }
+      'qualified'     { KW_Qualified }
+      'foreign'       { KW_Foreign }
+      'safe'          { KW_Safe }
+      'unsafe'        { KW_Unsafe }
+      'ccall'         { KW_CCall }
+      'stdcall'       { KW_Stdcall }
+      'primitive'     { KW_Primitive }
+      'forall'        { KW_Forall }
+      'exists'        { KW_Exists }
hunk ./FrontEnd/HsParser.y 132
-> bodyaux :: { ([HsImportDecl],[HsDecl]) }
->	: impdecls ';' topdecls optsemi			{ (reverse $1, fixupHsDecls (reverse $3)) }
->	|              topdecls optsemi			{ ([], fixupHsDecls (reverse $1)) }
->	| impdecls              optsemi			{ (reverse $1, []) }
->	| {- empty -}					{ ([], []) }
+%monad { P } { thenP } { returnP }
+%lexer { lexer } { EOF }
+%name parse module
+%name parseHsStmt qual
+%tokentype { Token }
+%%
hunk ./FrontEnd/HsParser.y 139
-> optsemi :: { () }
->	: ';'						{ () }
->	| {- empty -}					{ () }
+-- -----------------------------------------------------------------------------
+-- Module Header
+module :: { HsModule }
+      : srcloc modulep                  { $2 { hsModuleSrcLoc = $1, hsModuleOptions = [] } }
+      | srcloc PRAGMAOPTIONS module     { $3 { hsModuleSrcLoc = $1, hsModuleOptions = hsModuleOptions $3 ++ $2 } }
hunk ./FrontEnd/HsParser.y 145
------------------------------------------------------------------------------
-The Export List
+modulep  :: { HsModule }
+      : 'module' modid maybeexports 'where' body      { HsModule { hsModuleName = $2, hsModuleExports = $3, hsModuleImports = (fst $5), hsModuleDecls = (snd $5) } }
+      | body                                          { HsModule { hsModuleName = main_mod, hsModuleExports = Just [HsEVar (UnQual (HsIdent "main"))], hsModuleImports = (fst $1), hsModuleDecls = (snd $1) } }
hunk ./FrontEnd/HsParser.y 149
-> maybeexports :: { Maybe [HsExportSpec] }
-> 	:  exports				{ Just $1 }
-> 	|  {- empty -}				{ Nothing }
+body :: { ([HsImportDecl],[HsDecl]) }
+      :  '{' bodyaux '}'                              { $2 }
+      |      layout_on  bodyaux close                 { $2 }
hunk ./FrontEnd/HsParser.y 153
-> exports :: { [HsExportSpec] }
->	: '(' exportlist maybecomma ')'		{ reverse $2 }
->	| '(' ')'				{ [] }
+bodyaux :: { ([HsImportDecl],[HsDecl]) }
+      : impdecls ';' topdecls optsemi                 { (reverse $1, fixupHsDecls (reverse $3)) }
+      |              topdecls optsemi                 { ([], fixupHsDecls (reverse $1)) }
+      | impdecls              optsemi                 { (reverse $1, []) }
+      | {- empty -}                                   { ([], []) }
hunk ./FrontEnd/HsParser.y 159
-> maybecomma :: { () }
->	: ','					{ () }
->	| {- empty -}				{ () }
+optsemi :: { () }
+      : ';'                                           { () }
+      | {- empty -}                                   { () }
hunk ./FrontEnd/HsParser.y 163
-> exportlist :: { [HsExportSpec] }
-> 	:  exportlist ',' export		{ $3 : $1 }
-> 	|  export				{ [$1]  }
+-- -----------------------------------------------------------------------------
+-- The Export List
hunk ./FrontEnd/HsParser.y 166
-> export :: { HsExportSpec }
-> 	:  qvar					{ HsEVar $1 }
-> 	|  qtyconorcls				{ HsEAbs $1 }
-> 	|  qtyconorcls '(' '..' ')'		{ HsEThingAll $1 }
-> 	|  qtyconorcls '(' ')'		        { HsEThingWith $1 [] }
-> 	|  qtyconorcls '(' qcnames ')'		{ HsEThingWith $1 (reverse $3) }
-> 	|  'module' modid			{ HsEModuleContents $2 }
+maybeexports :: { Maybe [HsExportSpec] }
+      :  exports                              { Just $1 }
+      |  {- empty -}                          { Nothing }
hunk ./FrontEnd/HsParser.y 170
-> qcnames :: { [HsName] }
-> 	:  qcnames ',' qcname			{ $3 : $1 }
-> 	|  qcname				{ [$1]  }
+exports :: { [HsExportSpec] }
+      : '(' exportlist maybecomma ')'         { reverse $2 }
+      | '(' ')'                               { [] }
hunk ./FrontEnd/HsParser.y 174
-> qcname :: { HsName }
->	:  qvar					{ $1 }
-> 	|  qcon					{ $1 }
+maybecomma :: { () }
+      : ','                                   { () }
+      | {- empty -}                           { () }
hunk ./FrontEnd/HsParser.y 178
------------------------------------------------------------------------------
-Import Declarations
+exportlist :: { [HsExportSpec] }
+      :  exportlist ',' export                { $3 : $1 }
+      |  export                               { [$1]  }
hunk ./FrontEnd/HsParser.y 182
-> impdecls :: { [HsImportDecl] }
->	: impdecls ';' impdecl			{ $3 : $1 }
->	| impdecl				{ [$1] }
+export :: { HsExportSpec }
+      :  qvar                                 { HsEVar $1 }
+      |  qtyconorcls                          { HsEAbs $1 }
+      |  qtyconorcls '(' '..' ')'             { HsEThingAll $1 }
+      |  qtyconorcls '(' ')'                  { HsEThingWith $1 [] }
+      |  qtyconorcls '(' qcnames ')'          { HsEThingWith $1 (reverse $3) }
+      |  'module' modid                       { HsEModuleContents $2 }
hunk ./FrontEnd/HsParser.y 190
-> impdecl :: { HsImportDecl }
->	: 'import' srcloc optqualified modid maybeas maybeimpspec
-> 		  		{ HsImportDecl $2 $4 $3 $5 $6 }
+qcnames :: { [HsName] }
+      :  qcnames ',' qcname                   { $3 : $1 }
+      |  qcname                               { [$1]  }
hunk ./FrontEnd/HsParser.y 194
-> optqualified :: { Bool }
->       : 'qualified'                           { True  }
->       | {- empty -}				{ False }
+qcname :: { HsName }
+      :  qvar                                 { $1 }
+      |  qcon                                 { $1 }
hunk ./FrontEnd/HsParser.y 198
-> maybeas :: { Maybe Module }
->       : 'as' modid                            { Just $2 }
->       | {- empty -}				{ Nothing }
+-- -----------------------------------------------------------------------------
+-- Import Declarations
hunk ./FrontEnd/HsParser.y 201
+impdecls :: { [HsImportDecl] }
+      : impdecls ';' impdecl                  { $3 : $1 }
+      | impdecl                               { [$1] }
hunk ./FrontEnd/HsParser.y 205
-> maybeimpspec :: { Maybe (Bool, [HsImportSpec]) }
->	: impspec				{ Just $1 }
->	| {- empty -}				{ Nothing }
+impdecl :: { HsImportDecl }
+      : 'import' srcloc optqualified modid maybeas maybeimpspec
+                              { HsImportDecl $2 $4 $3 $5 $6 }
hunk ./FrontEnd/HsParser.y 209
-> impspec :: { (Bool, [HsImportSpec]) }
-> 	:  '(' importlist maybecomma ')'  	{ (False, reverse $2) }
-> 	|  'hiding' '(' importlist maybecomma ')' { (True,  reverse $3) }
+optqualified :: { Bool }
+      : 'qualified'                           { True  }
+      | {- empty -}                           { False }
hunk ./FrontEnd/HsParser.y 213
-> importlist :: { [HsImportSpec] }
-> 	:  importlist ',' import		{ $3 : $1 }
-> 	|  import				{ [$1]  }
+maybeas :: { Maybe Module }
+      : 'as' modid                            { Just $2 }
+      | {- empty -}                           { Nothing }
hunk ./FrontEnd/HsParser.y 217
-> import :: { HsImportSpec }
-> 	:  var					{ HsIVar $1 }
-> 	|  tyconorcls				{ HsIAbs $1 }
-> 	|  tyconorcls '(' '..' ')'		{ HsIThingAll $1 }
-> 	|  tyconorcls '(' ')'		        { HsIThingWith $1 [] }
-> 	|  tyconorcls '(' cnames ')'		{ HsIThingWith $1 (reverse $3) }
hunk ./FrontEnd/HsParser.y 218
-> cnames :: { [HsName] }
-> 	:  cnames ',' cname			{ $3 : $1 }
-> 	|  cname				{ [$1]  }
+maybeimpspec :: { Maybe (Bool, [HsImportSpec]) }
+      : impspec                               { Just $1 }
+      | {- empty -}                           { Nothing }
hunk ./FrontEnd/HsParser.y 222
-> cname :: { HsName }
->	:  var					{ $1 }
-> 	|  con					{ $1 }
+impspec :: { (Bool, [HsImportSpec]) }
+      :  '(' importlist maybecomma ')'        { (False, reverse $2) }
+      |  'hiding' '(' importlist maybecomma ')' { (True,  reverse $3) }
hunk ./FrontEnd/HsParser.y 226
------------------------------------------------------------------------------
-Fixity Declarations
+importlist :: { [HsImportSpec] }
+      :  importlist ',' import                { $3 : $1 }
+      |  import                               { [$1]  }
hunk ./FrontEnd/HsParser.y 230
-> fixdecl :: { HsDecl }
-> 	: srcloc infix prec ops			{ HsInfixDecl $1 $2 $3 (reverse $4) }
+import :: { HsImportSpec }
+      :  var                                  { HsIVar $1 }
+      |  tyconorcls                           { HsIAbs $1 }
+      |  tyconorcls '(' '..' ')'              { HsIThingAll $1 }
+      |  tyconorcls '(' ')'                   { HsIThingWith $1 [] }
+      |  tyconorcls '(' cnames ')'            { HsIThingWith $1 (reverse $3) }
hunk ./FrontEnd/HsParser.y 237
-> prec :: { Int }
->	: {- empty -}				{ 9 }
->	| INT					{%  checkPrec $1 `thenP` \p ->
->						    returnP (fromInteger (readInteger p)) }
+cnames :: { [HsName] }
+      :  cnames ',' cname                     { $3 : $1 }
+      |  cname                                { [$1]  }
hunk ./FrontEnd/HsParser.y 241
-> infix :: { HsAssoc }
->	: 'infix'				{ HsAssocNone  }
->	| 'infixl'				{ HsAssocLeft  }
->	| 'infixr'				{ HsAssocRight }
+cname :: { HsName }
+      :  var                                  { $1 }
+      |  con                                  { $1 }
hunk ./FrontEnd/HsParser.y 245
-> ops   :: { [HsName] }
->	: ops ',' op				{ $3 : $1 }
->	| op					{ [$1] }
+-- -----------------------------------------------------------------------------
+-- Fixity Declarations
hunk ./FrontEnd/HsParser.y 248
------------------------------------------------------------------------------
-Top-Level Declarations
+fixdecl :: { HsDecl }
+      : srcloc infix prec ops                 { HsInfixDecl $1 $2 $3 (reverse $4) }
hunk ./FrontEnd/HsParser.y 251
-Note: The report allows topdecls to be empty. This would result in another
-shift/reduce-conflict, so we don't handle this case here, but in bodyaux.
+prec :: { Int }
+      : {- empty -}                           { 9 }
+      | INT                                   {%  checkPrec $1 `thenP` \p ->
+                                                  returnP (fromInteger (readInteger p)) }
hunk ./FrontEnd/HsParser.y 256
-> topdecls :: { [HsDecl] }
->	: topdecls ';' topdecl		{ $3 : $1 }
->	| topdecl			{ [$1] }
+infix :: { HsAssoc }
+      : 'infix'                               { HsAssocNone  }
+      | 'infixl'                              { HsAssocLeft  }
+      | 'infixr'                              { HsAssocRight }
hunk ./FrontEnd/HsParser.y 261
-> topdecl :: { HsDecl }
->       : 'data' ctype srcloc deriving
->           {% checkDataHeader $2 `thenP` \(cs,c,t) ->
->              returnP (HsDataDecl $3 cs c t [] $4) }
->	| 'data' ctype srcloc '=' constrs deriving
->			{% checkDataHeader $2 `thenP` \(cs,c,t) ->
->			   returnP (HsDataDecl $3 cs c t (reverse $5) $6) }
->	| 'newtype' ctype srcloc '=' constr deriving
->			{% checkDataHeader $2 `thenP` \(cs,c,t) ->
->			   returnP (HsNewTypeDecl $3 cs c t $5 $6) }
->	| 'class' srcloc ctype optfundep optcbody
->			{ HsClassDecl $2 $3 $5 }
->	| 'instance' srcloc ctype optvaldefs
->			{ HsInstDecl $2 $3 $4 }
->	| 'default' srcloc type
->			{ HsDefaultDecl $2 $3 }
->       | 'foreign' srcloc 'export' mcconv mstring var '::' ctype
->                       {% parseExport $5 $6 >>= \x ->
->                          return (HsForeignExport $2 (FfiExport x Safe $4) $6 $8) }
->       | 'foreign' srcloc 'import' 'primitive' mstring var '::' ctype
->                       { let i = Import (if null $5 then show $6 else $5) nullRequires
->                         in HsForeignDecl $2 (FfiSpec i Safe Primitive) $6 $8 }
->       | 'foreign' srcloc 'import' mcconv msafety mstring var '::' ctype
->                       {% parseImport $6 $7 >>= \x ->
->                          return (HsForeignDecl $2 (FfiSpec x $5 $4) $7 $9) }
->       | PRAGMARULES layout_on rules close PRAGMAEND
->               { HsPragmaRules $ map (\x -> x { hsRuleIsMeta = $1 }) (reverse $3) }
->       | srcloc PRAGMASPECIALIZE var '::' type PRAGMAEND
->                       { HsPragmaSpecialize { hsDeclSrcLoc = $1, hsDeclBool = $2, hsDeclName = $3, hsDeclType = $5 } }
->       | decl		{ $1 }
+ops   :: { [HsName] }
+      : ops ',' op                            { $3 : $1 }
+      | op                                    { [$1] }
hunk ./FrontEnd/HsParser.y 265
-> rule :: { HsRule }
->       : srcloc STRING mfreevars exp '=' exp
->          { HsRule { hsRuleSrcLoc = $1, hsRuleString = $2, hsRuleFreeVars = $3, hsRuleLeftExpr = $4, hsRuleRightExpr = $6 } }
+-- -----------------------------------------------------------------------------
+-- Top-Level Declarations
hunk ./FrontEnd/HsParser.y 268
-> rules :: { [HsRule] }
->       : rules optsemi rule  { $3 : $1 }
->       | rule optsemi           { [$1] }
+-- Note: The report allows topdecls to be empty. This would result in another
+-- shift/reduce-conflict, so we don't handle this case here, but in bodyaux.
hunk ./FrontEnd/HsParser.y 271
+topdecls :: { [HsDecl] }
+      : topdecls ';' topdecl          { $3 : $1 }
+      | topdecl                       { [$1] }
hunk ./FrontEnd/HsParser.y 275
-> mfreevars :: { [(HsName,Maybe HsType)] }
->       : 'forall' vbinds '.' { $2 }
->       | { [] }
+topdecl :: { HsDecl }
+      : 'data' ctype srcloc deriving
+          {% checkDataHeader $2 `thenP` \(cs,c,t) ->
+             returnP (HsDataDecl $3 cs c t [] $4) }
+      | 'data' ctype srcloc '=' constrs deriving
+                      {% checkDataHeader $2 `thenP` \(cs,c,t) ->
+                         returnP (HsDataDecl $3 cs c t (reverse $5) $6) }
+      | 'newtype' ctype srcloc '=' constr deriving
+                      {% checkDataHeader $2 `thenP` \(cs,c,t) ->
+                         returnP (HsNewTypeDecl $3 cs c t $5 $6) }
+      | 'class' srcloc ctype optfundep optcbody
+                      { HsClassDecl $2 $3 $5 }
+      | 'instance' srcloc ctype optvaldefs
+                      { HsInstDecl $2 $3 $4 }
+      | 'default' srcloc type
+                      { HsDefaultDecl $2 $3 }
+      | 'foreign' srcloc 'export' mcconv mstring var '::' ctype
+                      {% parseExport $5 $6 >>= \x ->
+                         return (HsForeignExport $2 (FfiExport x Safe $4) $6 $8) }
+      | 'foreign' srcloc 'import' 'primitive' mstring var '::' ctype
+                      { let i = Import (if null $5 then show $6 else $5) nullRequires
+                        in HsForeignDecl $2 (FfiSpec i Safe Primitive) $6 $8 }
+      | 'foreign' srcloc 'import' mcconv msafety mstring var '::' ctype
+                      {% parseImport $6 $7 >>= \x ->
+                         return (HsForeignDecl $2 (FfiSpec x $5 $4) $7 $9) }
+      | PRAGMARULES layout_on rules close PRAGMAEND
+              { HsPragmaRules $ map (\x -> x { hsRuleIsMeta = $1 }) (reverse $3) }
+      | srcloc PRAGMASPECIALIZE var '::' type PRAGMAEND
+                      { HsPragmaSpecialize { hsDeclSrcLoc = $1, hsDeclBool = $2, hsDeclName = $3, hsDeclType = $5 } }
+      | decl          { $1 }
hunk ./FrontEnd/HsParser.y 306
-> vbinds :: { [(HsName,Maybe HsType)] }
->       : vbinds '(' var '::' type ')' { ($3,Just $5) : $1 }
->       | vbinds var                   { ($2,Nothing) : $1 }
->       |                              { [] }
+rule :: { HsRule }
+      : srcloc STRING mfreevars exp '=' exp
+         { HsRule { hsRuleSrcLoc = $1, hsRuleString = $2, hsRuleFreeVars = $3, hsRuleLeftExpr = $4, hsRuleRightExpr = $6 } }
hunk ./FrontEnd/HsParser.y 310
-> decls :: { [HsDecl] }
->	: decls1 optsemi		{ fixupHsDecls ( reverse $1 ) }
->	| optsemi 			{ [] }
+rules :: { [HsRule] }
+      : rules optsemi rule  { $3 : $1 }
+      | rule optsemi           { [$1] }
hunk ./FrontEnd/HsParser.y 314
-> decls1 :: { [HsDecl] }
->	: decls1 ';' decl		{ $3 : $1 }
->	| decl				{ [$1] }
hunk ./FrontEnd/HsParser.y 315
-> decl :: { HsDecl }
->	: signdecl			{ $1 }
->	| fixdecl			{ $1 }
->	| valdef			{ $1 }
->       | pragmaprops                   { $1 }
+mfreevars :: { [(HsName,Maybe HsType)] }
+      : 'forall' vbinds '.' { $2 }
+      | { [] }
hunk ./FrontEnd/HsParser.y 319
+vbinds :: { [(HsName,Maybe HsType)] }
+      : vbinds '(' var '::' type ')' { ($3,Just $5) : $1 }
+      | vbinds var                   { ($2,Nothing) : $1 }
+      |                              { [] }
hunk ./FrontEnd/HsParser.y 324
+decls :: { [HsDecl] }
+      : decls1 optsemi                { fixupHsDecls ( reverse $1 ) }
+      | optsemi                       { [] }
hunk ./FrontEnd/HsParser.y 328
-> decllist :: { [HsDecl] }
->	: '{' decls '}'			{ $2 }
->	|     layout_on  decls close	{ $2 }
+decls1 :: { [HsDecl] }
+      : decls1 ';' decl               { $3 : $1 }
+      | decl                          { [$1] }
hunk ./FrontEnd/HsParser.y 332
-> signdecl :: { HsDecl }
->	: vars srcloc '::' ctype	{ HsTypeSig $2 (reverse $1) $4 }
+decl :: { HsDecl }
+      : signdecl                      { $1 }
+      | fixdecl                       { $1 }
+      | valdef                        { $1 }
+      | pragmaprops                   { $1 }
hunk ./FrontEnd/HsParser.y 338
-> pragmaprops  :: { HsDecl }
->       : PRAGMASTART srcloc  vars PRAGMAEND  { HsPragmaProps $2 $1 $3 }
hunk ./FrontEnd/HsParser.y 339
-ATTENTION: Dirty Hackery Ahead! If the second alternative of vars is var
-instead of qvar, we get another shift/reduce-conflict. Consider the
-following programs:
hunk ./FrontEnd/HsParser.y 340
-   { (+) :: ... }          only var
-   { (+) x y  = ... }      could (incorrectly) be qvar
+decllist :: { [HsDecl] }
+      : '{' decls '}'                 { $2 }
+      |     layout_on  decls close    { $2 }
hunk ./FrontEnd/HsParser.y 344
-We re-use expressions for patterns, so a qvar would be allowed in patterns
-instead of a var only (which would be correct). But deciding what the + is,
-would require more lookahead. So let's check for ourselves...
+signdecl :: { HsDecl }
+      : vars srcloc '::' ctype        { HsTypeSig $2 (reverse $1) $4 }
hunk ./FrontEnd/HsParser.y 347
-> vars	:: { [HsName] }
->	: vars ',' var			{ $3 : $1 }
->	| qvar				{% checkUnQual $1 `thenP` \n ->
->					   returnP [n] }
+pragmaprops  :: { HsDecl }
+      : PRAGMASTART srcloc  vars PRAGMAEND  { HsPragmaProps $2 $1 $3 }
hunk ./FrontEnd/HsParser.y 350
-FFI parts
+-- ATTENTION: Dirty Hackery Ahead! If the second alternative of vars is var
+-- instead of qvar, we get another shift/reduce-conflict. Consider the
+-- following programs:
hunk ./FrontEnd/HsParser.y 354
-> mcconv :: { CallConv }
-> mcconv : 'ccall'        { CCall }
->        | 'stdcall'      { StdCall }
->        | {- empty -}    { CCall }
->
-> msafety :: { Safety }
-> msafety : 'safe'        { Safe }
->         | 'unsafe'      { Unsafe }
->         | {- empty -}   { Safe }
->
-> mstring :: { String }
-> mstring : STRING         { $1 }
->         | {- empty -}    { "" }
+--    { (+) :: ... }          only var
+--    { (+) x y  = ... }      could (incorrectly) be qvar
hunk ./FrontEnd/HsParser.y 357
------------------------------------------------------------------------------
-Types
+-- We re-use expressions for patterns, so a qvar would be allowed in patterns
+-- instead of a var only (which would be correct). But deciding what the + is,
+-- would require more lookahead. So let's check for ourselves...
hunk ./FrontEnd/HsParser.y 361
-> type :: { HsType }
->	: btype '->' type		{ HsTyFun $1 $3 }
->	| btype				{ $1 }
->       | 'forall' tbinds '.' ctype     { HsTyForall { hsTypeVars = reverse $2, hsTypeType = $4 } }
->       | 'exists' tbinds '.' ctype     { HsTyExists { hsTypeVars = reverse $2, hsTypeType = $4 } }
+vars  :: { [HsName] }
+      : vars ',' var                  { $3 : $1 }
+      | qvar                          {% checkUnQual $1 `thenP` \n ->
+                                         returnP [n] }
hunk ./FrontEnd/HsParser.y 366
-> tbinds :: { [HsTyVarBind] }
->       : tbinds tbind                  { $2 : $1 }
->       | tbind                         { [$1] }
+-- FFI parts
hunk ./FrontEnd/HsParser.y 368
-> tbind :: { HsTyVarBind }
->        : srcloc varid                   { hsTyVarBind { hsTyVarBindSrcLoc = $1, hsTyVarBindName = $2 } }
->        | srcloc '(' varid '::' kind ')' { hsTyVarBind { hsTyVarBindSrcLoc = $1, hsTyVarBindName = $3, hsTyVarBindKind = Just $5 } }
+mcconv :: { CallConv }
+mcconv : 'ccall'        { CCall }
+       | 'stdcall'      { StdCall }
+       | {- empty -}    { CCall }
hunk ./FrontEnd/HsParser.y 373
-> kind :: { HsKind }
->       : bkind                          { $1 }
->       | bkind '->' kind                { HsKindFn $1 $3 }
+msafety :: { Safety }
+msafety : 'safe'        { Safe }
+        | 'unsafe'      { Unsafe }
+        | {- empty -}   { Safe }
hunk ./FrontEnd/HsParser.y 378
-> bkind :: { HsKind }
->        : '(' kind ')'           { $2 }
->        |  '*'                   { hsKindStar }
+mstring :: { String }
+mstring : STRING         { $1 }
+        | {- empty -}    { "" }
hunk ./FrontEnd/HsParser.y 382
-> btype :: { HsType }
->	: btype atype			{ HsTyApp $1 $2 }
->	| atype				{ $1 }
+-- -----------------------------------------------------------------------------
+-- Types
hunk ./FrontEnd/HsParser.y 385
-> atype :: { HsType }
->	: gtycon			{ HsTyCon $1 }
->	| tyvar				{ HsTyVar $1 }
->	| '(' types ')'			{ HsTyTuple (reverse $2) }
->	| '(#' '#)'	                { HsTyUnboxedTuple [] }
->	| '(#' type '#)'	        { HsTyUnboxedTuple [$2] }
->	| '(#' types '#)'		{ HsTyUnboxedTuple (reverse $2) }
->	| '[' type ']'			{ HsTyApp list_tycon $2 }
->	| '(' type ')'			{ $2 }
->	| '(' type '=' type ')'         { HsTyEq $2 $4 }
+type :: { HsType }
+      : btype '->' type               { HsTyFun $1 $3 }
+      | btype                         { $1 }
+      | 'forall' tbinds '.' ctype     { HsTyForall { hsTypeVars = reverse $2, hsTypeType = $4 } }
+      | 'exists' tbinds '.' ctype     { HsTyExists { hsTypeVars = reverse $2, hsTypeType = $4 } }
hunk ./FrontEnd/HsParser.y 391
-> gtycon :: { HsName }
->	: qconid			{ $1 }
->	| '(' ')'			{ unit_tycon_name }
->	| '(' '->' ')'			{ fun_tycon_name }
->	| '[' ']'			{ list_tycon_name }
->	| '(' commas ')'		{ tuple_tycon_name $2 }
+tbinds :: { [HsTyVarBind] }
+      : tbinds tbind                  { $2 : $1 }
+      | tbind                         { [$1] }
hunk ./FrontEnd/HsParser.y 395
+tbind :: { HsTyVarBind }
+       : srcloc varid                   { hsTyVarBind { hsTyVarBindSrcLoc = $1, hsTyVarBindName = $2 } }
+       | srcloc '(' varid '::' kind ')' { hsTyVarBind { hsTyVarBindSrcLoc = $1, hsTyVarBindName = $3, hsTyVarBindKind = Just $5 } }
hunk ./FrontEnd/HsParser.y 399
-(Slightly edited) Comment from GHC's hsparser.y:
-"context => type" vs  "type" is a problem, because you can't distinguish between
+kind :: { HsKind }
+      : bkind                          { $1 }
+      | bkind '->' kind                { HsKindFn $1 $3 }
hunk ./FrontEnd/HsParser.y 403
-	foo :: (Baz a, Baz a)
-	bar :: (Baz a, Baz a) => [a] -> [a] -> [a]
+bkind :: { HsKind }
+       : '(' kind ')'           { $2 }
+       |  '*'                   { hsKindStar }
hunk ./FrontEnd/HsParser.y 407
-with one token of lookahead.  The HACK is to parse the context as a btype
-(more specifically as a tuple type), then check that it has the right form
-C a, or (C1 a, C2 b, ... Cn z) and convert it into a context.  Blaach!
+btype :: { HsType }
+      : btype atype                   { HsTyApp $1 $2 }
+      | atype                         { $1 }
hunk ./FrontEnd/HsParser.y 411
-> ctype :: { HsQualType }
->	: btype '=>' type		{% checkContext $1 `thenP` \c ->
->					   returnP (HsQualType c $3) }
->	| type				{ HsQualType [] $1 }
+atype :: { HsType }
+      : gtycon                        { HsTyCon $1 }
+      | tyvar                         { HsTyVar $1 }
+      | '(' types ')'                 { HsTyTuple (reverse $2) }
+      | '(#' '#)'                     { HsTyUnboxedTuple [] }
+      | '(#' type '#)'                { HsTyUnboxedTuple [$2] }
+      | '(#' types '#)'               { HsTyUnboxedTuple (reverse $2) }
+      | '[' type ']'                  { HsTyApp list_tycon $2 }
+      | '(' type ')'                  { $2 }
+      | '(' type '=' type ')'         { HsTyEq $2 $4 }
hunk ./FrontEnd/HsParser.y 422
-> types	:: { [HsType] }
->	: types ',' type		{ $3 : $1 }
->	| type  ',' type		{ [$3, $1] }
+gtycon :: { HsName }
+      : qconid                        { $1 }
+      | '(' ')'                       { unit_tycon_name }
+      | '(' '->' ')'                  { fun_tycon_name }
+      | '[' ']'                       { list_tycon_name }
+      | '(' commas ')'                { tuple_tycon_name $2 }
hunk ./FrontEnd/HsParser.y 429
-> simpletype :: { (HsName, [HsType]) }
->	: tycon atypes			{ ($1,reverse $2) }
hunk ./FrontEnd/HsParser.y 430
-> atypes :: { [HsType] }
->	: atypes atype			{ $2 : $1 }
->	| {- empty -}			{ [] }
+-- (Slightly edited) Comment from GHC's hsparser.y:
+-- "context => type" vs  "type" is a problem, because you can't distinguish between
hunk ./FrontEnd/HsParser.y 433
------------------------------------------------------------------------------
-Datatype declarations
+--      foo :: (Baz a, Baz a)
+--      bar :: (Baz a, Baz a) => [a] -> [a] -> [a]
hunk ./FrontEnd/HsParser.y 436
-> constrs :: { [HsConDecl] }
->	: constrs '|' constr		{ $3 : $1 }
->	| constr			{ [$1] }
+-- with one token of lookahead.  The HACK is to parse the context as a btype
+-- (more specifically as a tuple type), then check that it has the right form
+-- C a, or (C1 a, C2 b, ... Cn z) and convert it into a context.  Blaach!
hunk ./FrontEnd/HsParser.y 440
-> constr :: { HsConDecl }
->	: srcloc mexists scontype		{ HsConDecl { hsConDeclSrcLoc = $1, hsConDeclName = (fst $3), hsConDeclConArg = (snd $3), hsConDeclExists = $2 } }
->	| srcloc mexists sbtype conop sbtype	{ HsConDecl { hsConDeclSrcLoc = $1, hsConDeclName = $4, hsConDeclConArg = [$3,$5], hsConDeclExists = $2 } }
->	| srcloc mexists con '{' fielddecls '}'
->					{ HsRecDecl { hsConDeclSrcLoc = $1, hsConDeclName = $3, hsConDeclRecArg = (reverse $5), hsConDeclExists = $2 } }
+ctype :: { HsQualType }
+      : btype '=>' type               {% checkContext $1 `thenP` \c ->
+                                         returnP (HsQualType c $3) }
+      | type                          { HsQualType [] $1 }
hunk ./FrontEnd/HsParser.y 445
-> mexists :: { [HsTyVarBind] }
->         : 'exists' tbinds '.'         { $2 }
->         | 'forall' tbinds '.'         { $2 }  -- Allowed for GHC compatability
->         |                             { [] }
+types :: { [HsType] }
+      : types ',' type                { $3 : $1 }
+      | type  ',' type                { [$3, $1] }
hunk ./FrontEnd/HsParser.y 449
-> scontype :: { (HsName, [HsBangType]) }
->	: btype				{% splitTyConApp $1 `thenP` \(c,ts) ->
->					   returnP (c,map HsUnBangedTy ts) }
->	| scontype1			{ $1 }
+simpletype :: { (HsName, [HsType]) }
+      : tycon atypes                  { ($1,reverse $2) }
hunk ./FrontEnd/HsParser.y 452
-> scontype1 :: { (HsName, [HsBangType]) }
->	: btype '!' atype		{% splitTyConApp $1 `thenP` \(c,ts) ->
->					   returnP (c,map HsUnBangedTy ts++
->						 	[HsBangedTy $3]) }
->	| scontype1 satype		{ (fst $1, snd $1 ++ [$2] ) }
+atypes :: { [HsType] }
+      : atypes atype                  { $2 : $1 }
+      | {- empty -}                   { [] }
hunk ./FrontEnd/HsParser.y 456
-> satype :: { HsBangType }
->	: atype				{ HsUnBangedTy $1 }
->	| '!' atype			{ HsBangedTy   $2 }
+-- -----------------------------------------------------------------------------
+-- Datatype declarations
hunk ./FrontEnd/HsParser.y 459
-> sbtype :: { HsBangType }
->	: btype				{ HsUnBangedTy $1 }
->	| '!' atype			{ HsBangedTy   $2 }
+constrs :: { [HsConDecl] }
+      : constrs '|' constr            { $3 : $1 }
+      | constr                        { [$1] }
hunk ./FrontEnd/HsParser.y 463
-> fielddecls :: { [([HsName],HsBangType)] }
->	: fielddecls ',' fielddecl	{ $3 : $1 }
->	| fielddecl			{ [$1] }
+constr :: { HsConDecl }
+      : srcloc mexists scontype               { HsConDecl { hsConDeclSrcLoc = $1, hsConDeclName = (fst $3), hsConDeclConArg = (snd $3), hsConDeclExists = $2 } }
+      | srcloc mexists sbtype conop sbtype    { HsConDecl { hsConDeclSrcLoc = $1, hsConDeclName = $4, hsConDeclConArg = [$3,$5], hsConDeclExists = $2 } }
+      | srcloc mexists con '{' fielddecls '}'
+                                      { HsRecDecl { hsConDeclSrcLoc = $1, hsConDeclName = $3, hsConDeclRecArg = (reverse $5), hsConDeclExists = $2 } }
hunk ./FrontEnd/HsParser.y 469
-> fielddecl :: { ([HsName],HsBangType) }
->	: vars '::' stype		{ (reverse $1, $3) }
+mexists :: { [HsTyVarBind] }
+        : 'exists' tbinds '.'         { $2 }
+        | 'forall' tbinds '.'         { $2 }  -- Allowed for GHC compatability
+        |                             { [] }
hunk ./FrontEnd/HsParser.y 474
-> stype :: { HsBangType }
->	: type				{ HsUnBangedTy $1 }
->	| '!' atype			{ HsBangedTy   $2 }
+scontype :: { (HsName, [HsBangType]) }
+      : btype                         {% splitTyConApp $1 `thenP` \(c,ts) ->
+                                         returnP (c,map HsUnBangedTy ts) }
+      | scontype1                     { $1 }
hunk ./FrontEnd/HsParser.y 479
-> deriving :: { [HsName] }
->	: {- empty -}			{ [] }
->	| 'deriving' qtycls		{ [$2] }
->	| 'deriving' '('          ')'	{ [] }
->	| 'deriving' '(' dclasses ')'	{ reverse $3 }
+scontype1 :: { (HsName, [HsBangType]) }
+      : btype '!' atype               {% splitTyConApp $1 `thenP` \(c,ts) ->
+                                         returnP (c,map HsUnBangedTy ts++
+                                                      [HsBangedTy $3]) }
+      | scontype1 satype              { (fst $1, snd $1 ++ [$2] ) }
hunk ./FrontEnd/HsParser.y 485
-> dclasses :: { [HsName] }
->	: dclasses ',' qtycls		{ $3 : $1 }
->       | qtycls			{ [$1] }
+satype :: { HsBangType }
+      : atype                         { HsUnBangedTy $1 }
+      | '!' atype                     { HsBangedTy   $2 }
hunk ./FrontEnd/HsParser.y 489
------------------------------------------------------------------------------
-Class declarations
+sbtype :: { HsBangType }
+      : btype                         { HsUnBangedTy $1 }
+      | '!' atype                     { HsBangedTy   $2 }
hunk ./FrontEnd/HsParser.y 493
-> optcbody :: { [HsDecl] }
->	: 'where' decllist			{ fixupHsDecls $2 }
->	| {- empty -}				{ [] }
+fielddecls :: { [([HsName],HsBangType)] }
+      : fielddecls ',' fielddecl      { $3 : $1 }
+      | fielddecl                     { [$1] }
hunk ./FrontEnd/HsParser.y 497
-> cdefaults :: { [HsDecl] }
->      : cdefaults ';' valdef                  { $3 : $1 }
->      | valdef                                { [$1] }
+fielddecl :: { ([HsName],HsBangType) }
+      : vars '::' stype               { (reverse $1, $3) }
hunk ./FrontEnd/HsParser.y 500
------------------------------------------------------------------------------
-Functional dependencies
+stype :: { HsBangType }
+      : type                          { HsUnBangedTy $1 }
+      | '!' atype                     { HsBangedTy   $2 }
hunk ./FrontEnd/HsParser.y 504
-> optfundep :: { [([HsName],[HsName])] }
->       : {- empty -}                           { [] }
->       | '|' fundeps                           { reverse $2 }
+deriving :: { [HsName] }
+      : {- empty -}                   { [] }
+      | 'deriving' qtycls             { [$2] }
+      | 'deriving' '('          ')'   { [] }
+      | 'deriving' '(' dclasses ')'   { reverse $3 }
hunk ./FrontEnd/HsParser.y 510
-> fundeps   :: { [([HsName],[HsName])] }
->       : fundeps ',' fundep                    { ($3:$1) }
->       | fundep                                { [$1]    }
+dclasses :: { [HsName] }
+      : dclasses ',' qtycls           { $3 : $1 }
+      | qtycls                        { [$1] }
hunk ./FrontEnd/HsParser.y 514
-> fundep    :: { ([HsName],[HsName]) }
->       : varids '->' varids                    { ($1,$3) }
+-- -----------------------------------------------------------------------------
+-- Class declarations
hunk ./FrontEnd/HsParser.y 517
-> varids    :: { [HsName] }
->       : {- empty -}                           { [] }
->       | varids tyvar                          { ($2:$1) }
+optcbody :: { [HsDecl] }
+      : 'where' decllist                      { fixupHsDecls $2 }
+      | {- empty -}                           { [] }
hunk ./FrontEnd/HsParser.y 521
------------------------------------------------------------------------------
-Instance declarations
+cdefaults :: { [HsDecl] }
+     : cdefaults ';' valdef                  { $3 : $1 }
+     | valdef                                { [$1] }
hunk ./FrontEnd/HsParser.y 525
-> optvaldefs :: { [HsDecl] }
->	: 'where' '{' valdefs '}'		{ $3 }
->	| 'where' layout_on valdefs close	{ $3 }
->	| {- empty -}				{ [] }
+-- -----------------------------------------------------------------------------
+-- Functional dependencies
hunk ./FrontEnd/HsParser.y 528
-Recycling...
+optfundep :: { [([HsName],[HsName])] }
+      : {- empty -}                           { [] }
+      | '|' fundeps                           { reverse $2 }
hunk ./FrontEnd/HsParser.y 532
-> valdefs :: { [HsDecl] }
->	: cdefaults optsemi			{ fixupHsDecls (reverse $1) }
->	| optsemi				{ [] }
+fundeps   :: { [([HsName],[HsName])] }
+      : fundeps ',' fundep                    { ($3:$1) }
+      | fundep                                { [$1]    }
hunk ./FrontEnd/HsParser.y 536
------------------------------------------------------------------------------
-Value definitions
+fundep    :: { ([HsName],[HsName]) }
+      : varids '->' varids                    { ($1,$3) }
hunk ./FrontEnd/HsParser.y 539
-> valdef :: { HsDecl }
->	: 'type' simpletype srcloc '=' type
->			{ HsTypeDecl $3 (fst $2) (snd $2) $5 }
->	| 'type' simpletype srcloc
->			{ HsTypeDecl $3 (fst $2) (snd $2) HsTyAssoc }
->	| infixexp srcloc rhs			{% checkValDef $2 $1 $3 []}
->	| infixexp srcloc rhs 'where' decllist	{% checkValDef $2 $1 $3 $5}
+varids    :: { [HsName] }
+      : {- empty -}                           { [] }
+      | varids tyvar                          { ($2:$1) }
hunk ./FrontEnd/HsParser.y 543
-> rhs	:: { HsRhs }
->	: '=' exp			{% checkExpr $2 `thenP` \e ->
->					   returnP (HsUnGuardedRhs e) }
->	| gdrhs				{ HsGuardedRhss  (reverse $1) }
+-- -----------------------------------------------------------------------------
+-- Instance declarations
hunk ./FrontEnd/HsParser.y 546
-> gdrhs :: { [HsGuardedRhs] }
->	: gdrhs gdrh			{ $2 : $1 }
->	| gdrh				{ [$1] }
+optvaldefs :: { [HsDecl] }
+      : 'where' '{' valdefs '}'               { $3 }
+      | 'where' layout_on valdefs close       { $3 }
+      | {- empty -}                           { [] }
hunk ./FrontEnd/HsParser.y 551
-> gdrh :: { HsGuardedRhs }
->	: '|' exp srcloc '=' exp	{% checkExpr $2 `thenP` \g ->
->					   checkExpr $5 `thenP` \e ->
->					   returnP (HsGuardedRhs $3 g e) }
+-- Recycling...
hunk ./FrontEnd/HsParser.y 553
------------------------------------------------------------------------------
-Expressions
+valdefs :: { [HsDecl] }
+      : cdefaults optsemi                     { fixupHsDecls (reverse $1) }
+      | optsemi                               { [] }
hunk ./FrontEnd/HsParser.y 557
-> exp   :: { HsExp }
->	: infixexp '::' srcloc ctype  	{ HsExpTypeSig $3 $1 $4 }
->	| infixexp			{ $1 }
+-- -----------------------------------------------------------------------------
+-- Value definitions
hunk ./FrontEnd/HsParser.y 560
-> infixexp :: { HsExp }
->	: exp10				{ $1 }
->	| infixexp qop exp10		{ HsInfixApp $1 $2 $3 }
+valdef :: { HsDecl }
+      : 'type' simpletype srcloc '=' type
+                      { HsTypeDecl $3 (fst $2) (snd $2) $5 }
+      | 'type' simpletype srcloc
+                      { HsTypeDecl $3 (fst $2) (snd $2) HsTyAssoc }
+      | infixexp srcloc rhs                   {% checkValDef $2 $1 $3 []}
+      | infixexp srcloc rhs 'where' decllist  {% checkValDef $2 $1 $3 $5}
hunk ./FrontEnd/HsParser.y 568
-> exp10 :: { HsExp }
->	: '\\' aexps srcloc '->' exp	{% checkPatterns (reverse $2) `thenP` \ps ->
->					   returnP (HsLambda $3 ps $5) }
->  	| 'let' decllist 'in' exp	{ HsLet $2 $4 }
--- >	| 'if' exp 'then' exp 'else' exp { HsIf $2 $4 $6 }
->	| 'if' exp optsemi 'then' exp optsemi 'else' exp { HsIf $2 $5 $8 }
->   	| 'case' exp 'of' altslist	{ HsCase $2 $4 }
->	| '-' fexp			{ HsNegApp $2 }
->  	| 'do' stmtlist			{ HsDo $2 }
->	| fexp				{ $1 }
+rhs   :: { HsRhs }
+      : '=' exp                       {% checkExpr $2 `thenP` \e ->
+                                         returnP (HsUnGuardedRhs e) }
+      | gdrhs                         { HsGuardedRhss  (reverse $1) }
hunk ./FrontEnd/HsParser.y 573
-> fexp :: { HsExp }
->	: fexp aexp			{ HsApp $1 $2 }
->  	| aexp				{ $1 }
+gdrhs :: { [HsGuardedRhs] }
+      : gdrhs gdrh                    { $2 : $1 }
+      | gdrh                          { [$1] }
hunk ./FrontEnd/HsParser.y 577
-> aexps :: { [HsExp] }
->	: aexps aexp			{ $2 : $1 }
->  	| aexp				{ [$1] }
+gdrh :: { HsGuardedRhs }
+      : '|' exp srcloc '=' exp        {% checkExpr $2 `thenP` \g ->
+                                         checkExpr $5 `thenP` \e ->
+                                         returnP (HsGuardedRhs $3 g e) }
hunk ./FrontEnd/HsParser.y 582
-UGLY: Because patterns and expressions are mixed, aexp has to be split into
-two rules: One left-recursive and one right-recursive. Otherwise we get two
-reduce/reduce-errors (for as-patterns and irrefutable patters).
+-- -----------------------------------------------------------------------------
+-- Expressions
hunk ./FrontEnd/HsParser.y 585
-Note: The first alternative of aexp is not neccessarily a record update, it
-could be a labeled construction, too.
+exp   :: { HsExp }
+      : infixexp '::' srcloc ctype    { HsExpTypeSig $3 $1 $4 }
+      | infixexp                      { $1 }
hunk ./FrontEnd/HsParser.y 589
-> aexp	:: { HsExp }
->  	: aexp '{' fbinds '}' 		{% mkRecConstrOrUpdate $1 (reverse $3) }
->  	| aexp1				{ $1 }
+infixexp :: { HsExp }
+      : exp10                         { $1 }
+      | infixexp qop exp10            { HsInfixApp $1 $2 $3 }
hunk ./FrontEnd/HsParser.y 593
-Even though the variable in an as-pattern cannot be qualified, we use
-qvar here to avoid a shift/reduce conflict, and then check it ourselves
-(as for vars above).
+exp10 :: { HsExp }
+      : '\\' aexps srcloc '->' exp    {% checkPatterns (reverse $2) `thenP` \ps ->
+                                         returnP (HsLambda $3 ps $5) }
+      | 'let' decllist 'in' exp       { HsLet $2 $4 }
+-- -- > | 'if' exp 'then' exp 'else' exp { HsIf $2 $4 $6 }
+      | 'if' exp optsemi 'then' exp optsemi 'else' exp { HsIf $2 $5 $8 }
+      | 'case' exp 'of' altslist      { HsCase $2 $4 }
+      | '-' fexp                      { HsNegApp $2 }
+      | 'do' stmtlist                 { HsDo $2 }
+      | fexp                          { $1 }
hunk ./FrontEnd/HsParser.y 604
-> aexp1	:: { HsExp }
->	: qvar				{ HsVar $1 }
->	| gcon				{ $1 }
->  	| literal			{ $1 }
->	| '(' exp ')'			{ HsParen $2 }
->	| '(' texps ')'			{ HsTuple (reverse $2) }
->	| '(#' '#)'		        { HsUnboxedTuple [] }
->	| '(#' exp '#)'		        { HsUnboxedTuple [$2] }
->	| '(#' texps '#)'		{ HsUnboxedTuple (reverse $2) }
->	| '[' list ']'                  { $2 }
->	| '(' infixexp qop ')'		{ HsLeftSection $3 $2  }
->	| '(' qopm infixexp ')'		{ HsRightSection $3 $2 }
->	| qvar '@' aexp1		{% checkUnQual $1 `thenP` \n ->
->					   returnP (HsAsPat n $3) }
->	| srcloc '_'			{ HsWildCard $1 }
->	| '~' aexp1			{ HsIrrPat $2 }
+fexp :: { HsExp }
+      : fexp aexp                     { HsApp $1 $2 }
+      | aexp                          { $1 }
hunk ./FrontEnd/HsParser.y 608
-> commas :: { Int }
->	: commas ','			{ $1 + 1 }
->	| ','				{ 1 }
+aexps :: { [HsExp] }
+      : aexps aexp                    { $2 : $1 }
+      | aexp                          { [$1] }
hunk ./FrontEnd/HsParser.y 612
-> texps :: { [HsExp] }
->	: texps ',' exp			{ $3 : $1 }
->	| exp ',' exp			{ [$3,$1] }
+-- UGLY: Because patterns and expressions are mixed, aexp has to be split into
+-- two rules: One left-recursive and one right-recursive. Otherwise we get two
+-- reduce/reduce-errors (for as-patterns and irrefutable patters).
hunk ./FrontEnd/HsParser.y 616
------------------------------------------------------------------------------
-List expressions
+-- Note: The first alternative of aexp is not neccessarily a record update, it
+-- could be a labeled construction, too.
hunk ./FrontEnd/HsParser.y 619
-The rules below are little bit contorted to keep lexps left-recursive while
-avoiding another shift/reduce-conflict.
+aexp  :: { HsExp }
+      : aexp '{' fbinds '}'           {% mkRecConstrOrUpdate $1 (reverse $3) }
+      | aexp1                         { $1 }
hunk ./FrontEnd/HsParser.y 623
-> list :: { HsExp }
->	: exp				{ HsList [$1] }
->	| lexps 			{ HsList (reverse $1) }
->	| exp '..'			{ HsEnumFrom $1 }
->	| exp ',' exp '..' 		{ HsEnumFromThen $1 $3 }
->	| exp '..' exp	 		{ HsEnumFromTo $1 $3 }
->	| exp ',' exp '..' exp		{ HsEnumFromThenTo $1 $3 $5 }
->	| exp '|' quals			{ HsListComp $1 (reverse $3) }
+-- Even though the variable in an as-pattern cannot be qualified, we use
+-- qvar here to avoid a shift/reduce conflict, and then check it ourselves
+-- (as for vars above).
hunk ./FrontEnd/HsParser.y 627
-> lexps :: { [HsExp] }
->	: lexps ',' exp 		{ $3 : $1 }
->	| exp ',' exp			{ [$3,$1] }
+aexp1 :: { HsExp }
+      : qvar                          { HsVar $1 }
+      | gcon                          { $1 }
+      | literal                       { $1 }
+      | '(' exp ')'                   { HsParen $2 }
+      | '(' texps ')'                 { HsTuple (reverse $2) }
+      | '(#' '#)'                     { HsUnboxedTuple [] }
+      | '(#' exp '#)'                 { HsUnboxedTuple [$2] }
+      | '(#' texps '#)'               { HsUnboxedTuple (reverse $2) }
+      | '[' list ']'                  { $2 }
+      | '(' infixexp qop ')'          { HsLeftSection $3 $2  }
+      | '(' qopm infixexp ')'         { HsRightSection $3 $2 }
+      | qvar '@' aexp1                {% checkUnQual $1 `thenP` \n ->
+                                         returnP (HsAsPat n $3) }
+      | srcloc '_'                    { HsWildCard $1 }
+      | '~' aexp1                     { HsIrrPat $2 }
hunk ./FrontEnd/HsParser.y 644
------------------------------------------------------------------------------
-List comprehensions
+commas :: { Int }
+      : commas ','                    { $1 + 1 }
+      | ','                           { 1 }
hunk ./FrontEnd/HsParser.y 648
-> quals :: { [HsStmt] }
->	: quals ',' qual			{ $3 : $1 }
->	| qual					{ [$1] }
+texps :: { [HsExp] }
+      : texps ',' exp                 { $3 : $1 }
+      | exp ',' exp                   { [$3,$1] }
hunk ./FrontEnd/HsParser.y 652
-> qual  :: { HsStmt }
->	: infixexp srcloc '<-' exp	{% checkPattern $1 `thenP` \p ->
->					   returnP (HsGenerator $2 p $4) }
->	| exp				{ HsQualifier $1 }
->  	| 'let' decllist		{ HsLetStmt $2 }
+-- -----------------------------------------------------------------------------
+-- List expressions
hunk ./FrontEnd/HsParser.y 655
------------------------------------------------------------------------------
-Case alternatives
+-- The rules below are little bit contorted to keep lexps left-recursive while
+-- avoiding another shift/reduce-conflict.
hunk ./FrontEnd/HsParser.y 658
-> altslist :: { [HsAlt] }
->	: '{' alts optsemi '}'			{ reverse $2 }
->	|     layout_on  alts optsemi close	{ reverse $2 }
+list :: { HsExp }
+      : exp                           { HsList [$1] }
+      | lexps                         { HsList (reverse $1) }
+      | exp '..'                      { HsEnumFrom $1 }
+      | exp ',' exp '..'              { HsEnumFromThen $1 $3 }
+      | exp '..' exp                  { HsEnumFromTo $1 $3 }
+      | exp ',' exp '..' exp          { HsEnumFromThenTo $1 $3 $5 }
+      | exp '|' quals                 { HsListComp $1 (reverse $3) }
hunk ./FrontEnd/HsParser.y 667
+lexps :: { [HsExp] }
+      : lexps ',' exp                 { $3 : $1 }
+      | exp ',' exp                   { [$3,$1] }
hunk ./FrontEnd/HsParser.y 671
-> alts :: { [HsAlt] }
->	: alts ';' alt				{ $3 : $1 }
->	| alt					{ [$1] }
+-- -----------------------------------------------------------------------------
+-- List comprehensions
hunk ./FrontEnd/HsParser.y 674
-> alt :: { HsAlt }
->	: infixexp srcloc ralt	{% checkPattern $1 `thenP` \p ->
->				   returnP (HsAlt $2 p $3 []) }
->	| infixexp srcloc ralt 'where' decllist
->				{% checkPattern $1 `thenP` \p ->
->				   returnP (HsAlt $2 p $3 $5) }
+quals :: { [HsStmt] }
+      : quals ',' qual                        { $3 : $1 }
+      | qual                                  { [$1] }
hunk ./FrontEnd/HsParser.y 678
-> ralt :: { HsRhs }
->	: '->' exp				{ HsUnGuardedRhs $2 }
->	| gdpats				{ HsGuardedRhss (reverse $1) }
+qual  :: { HsStmt }
+      : infixexp srcloc '<-' exp      {% checkPattern $1 `thenP` \p ->
+                                         returnP (HsGenerator $2 p $4) }
+      | exp                           { HsQualifier $1 }
+      | 'let' decllist                { HsLetStmt $2 }
hunk ./FrontEnd/HsParser.y 684
-> gdpats :: { [HsGuardedRhs] }
->	: gdpats gdpat				{ $2 : $1 }
->	| gdpat					{ [$1] }
+-- -----------------------------------------------------------------------------
+-- Case alternatives
hunk ./FrontEnd/HsParser.y 687
-> gdpat	:: { HsGuardedRhs }
->	: '|' exp srcloc '->' exp 		{ HsGuardedRhs $3 $2 $5 }
+altslist :: { [HsAlt] }
+      : '{' alts optsemi '}'                  { reverse $2 }
+      |     layout_on  alts optsemi close     { reverse $2 }
hunk ./FrontEnd/HsParser.y 691
------------------------------------------------------------------------------
-Statement sequences
hunk ./FrontEnd/HsParser.y 692
-> stmtlist :: { [HsStmt] }
->	  : '{' stmts '}'		{ $2 }
->	  |     layout_on  stmts close	{ $2 }
+alts :: { [HsAlt] }
+      : alts ';' alt                          { $3 : $1 }
+      | alt                                   { [$1] }
hunk ./FrontEnd/HsParser.y 696
-> stmts :: { [HsStmt] }
->       : stmts1 ';' exp		{ reverse (HsQualifier $3 : $1) }
-> 	| exp               		{ [HsQualifier $1] }
+alt :: { HsAlt }
+      : infixexp srcloc ralt  {% checkPattern $1 `thenP` \p ->
+                                 returnP (HsAlt $2 p $3 []) }
+      | infixexp srcloc ralt 'where' decllist
+                              {% checkPattern $1 `thenP` \p ->
+                                 returnP (HsAlt $2 p $3 $5) }
hunk ./FrontEnd/HsParser.y 703
-> stmts1 :: { [HsStmt] }
->	: stmts1 ';' qual		{ $3 : $1 }
->	| qual 				{ [$1] }
+ralt :: { HsRhs }
+      : '->' exp                              { HsUnGuardedRhs $2 }
+      | gdpats                                { HsGuardedRhss (reverse $1) }
hunk ./FrontEnd/HsParser.y 707
------------------------------------------------------------------------------
-Record Field Update/Construction
+gdpats :: { [HsGuardedRhs] }
+      : gdpats gdpat                          { $2 : $1 }
+      | gdpat                                 { [$1] }
hunk ./FrontEnd/HsParser.y 711
-> fbinds :: { [HsFieldUpdate] }
->	: fbinds ',' fbind		{ $3 : $1 }
->	| fbind				{ [$1] }
+gdpat :: { HsGuardedRhs }
+      : '|' exp srcloc '->' exp               { HsGuardedRhs $3 $2 $5 }
hunk ./FrontEnd/HsParser.y 714
-> fbind	:: { HsFieldUpdate }
->	: qvar '=' exp			{ HsFieldUpdate $1 $3 }
+-- -----------------------------------------------------------------------------
+-- Statement sequences
hunk ./FrontEnd/HsParser.y 717
------------------------------------------------------------------------------
-Variables, Constructors and Operators.
+stmtlist :: { [HsStmt] }
+        : '{' stmts '}'               { $2 }
+        |     layout_on  stmts close  { $2 }
hunk ./FrontEnd/HsParser.y 721
-> gcon :: { HsExp }
->  	: '(' ')'		{ unit_con }
->	| '[' ']'		{ HsList [] }
->	| '(' commas ')'	{ tuple_con $2 }
->  	| qcon			{ HsCon $1 }
+stmts :: { [HsStmt] }
+      : stmts1 ';' exp                { reverse (HsQualifier $3 : $1) }
+      | exp                           { [HsQualifier $1] }
hunk ./FrontEnd/HsParser.y 725
-> var 	:: { HsName }
->	: varid			{ $1 }
->	| '(' varsym ')'	{ $2 }
+stmts1 :: { [HsStmt] }
+      : stmts1 ';' qual               { $3 : $1 }
+      | qual                          { [$1] }
hunk ./FrontEnd/HsParser.y 729
-> qvar 	:: { HsName }
->	: qvarid		{ $1 }
->	| '(' qvarsym ')'	{ $2 }
+-- -----------------------------------------------------------------------------
+-- Record Field Update/Construction
hunk ./FrontEnd/HsParser.y 732
-> con	:: { HsName }
->	: conid			{ $1 }
->	| '(' consym ')'        { $2 }
+fbinds :: { [HsFieldUpdate] }
+      : fbinds ',' fbind              { $3 : $1 }
+      | fbind                         { [$1] }
hunk ./FrontEnd/HsParser.y 736
-> qcon	:: { HsName }
->	: qconid		{ $1 }
->	| '(' qconsym ')'	{ $2 }
+fbind :: { HsFieldUpdate }
+      : qvar '=' exp                  { HsFieldUpdate $1 $3 }
hunk ./FrontEnd/HsParser.y 739
-> varop	:: { HsName }
->	: varsym		{ $1 }
->	| '`' varid '`'		{ $2 }
+-- -----------------------------------------------------------------------------
+-- Variables, Constructors and Operators.
hunk ./FrontEnd/HsParser.y 742
-> qvarop :: { HsName }
->	: qvarsym		{ $1 }
->	| '`' qvarid '`'	{ $2 }
+gcon :: { HsExp }
+      : '(' ')'               { unit_con }
+      | '[' ']'               { HsList [] }
+      | '(' commas ')'        { tuple_con $2 }
+      | qcon                  { HsCon $1 }
hunk ./FrontEnd/HsParser.y 748
-> qvaropm :: { HsName }
->	: qvarsymm		{ $1 }
->	| '`' qvarid '`'	{ $2 }
+var   :: { HsName }
+      : varid                 { $1 }
+      | '(' varsym ')'        { $2 }
hunk ./FrontEnd/HsParser.y 752
-> conop :: { HsName }
->	: consym		{ $1 }
->	| '`' conid '`'		{ $2 }
+qvar  :: { HsName }
+      : qvarid                { $1 }
+      | '(' qvarsym ')'       { $2 }
hunk ./FrontEnd/HsParser.y 756
-> qconop :: { HsName }
->	: qconsym		{ $1 }
->	| '`' qconid '`'	{ $2 }
+con   :: { HsName }
+      : conid                 { $1 }
+      | '(' consym ')'        { $2 }
hunk ./FrontEnd/HsParser.y 760
-> op	:: { HsName }
->	: varop			{ $1 }
->	| conop 		{ $1 }
+qcon  :: { HsName }
+      : qconid                { $1 }
+      | '(' qconsym ')'       { $2 }
hunk ./FrontEnd/HsParser.y 764
-> qop	:: { HsExp }
->	: qvarop		{ HsVar $1 }
->	| qconop		{ HsCon $1 }
+varop :: { HsName }
+      : varsym                { $1 }
+      | '`' varid '`'         { $2 }
hunk ./FrontEnd/HsParser.y 768
-> qopm	:: { HsExp }
->	: qvaropm		{ HsVar $1 }
->	| qconop		{ HsCon $1 }
+qvarop :: { HsName }
+      : qvarsym               { $1 }
+      | '`' qvarid '`'        { $2 }
hunk ./FrontEnd/HsParser.y 772
-> qvarid :: { HsName }
->	: varid			{  $1 }
->	| QVARID		{ Qual (Module (fst $1)) (HsIdent (snd $1)) }
+qvaropm :: { HsName }
+      : qvarsymm              { $1 }
+      | '`' qvarid '`'        { $2 }
hunk ./FrontEnd/HsParser.y 776
-> varid :: { HsName }
->	: VARID			{ UnQual (HsIdent $1) }
->	| 'as'			{ as_name }
->	| 'qualified'		{ qualified_name }
->	| 'hiding'		{ hiding_name }
+conop :: { HsName }
+      : consym                { $1 }
+      | '`' conid '`'         { $2 }
hunk ./FrontEnd/HsParser.y 780
-> qconid :: { HsName }
->	: conid			{  $1 }
->	| QCONID		{ Qual (Module (fst $1)) (HsIdent (snd $1)) }
+qconop :: { HsName }
+      : qconsym               { $1 }
+      | '`' qconid '`'        { $2 }
hunk ./FrontEnd/HsParser.y 784
-> conid :: { HsName }
->	: CONID			{ UnQual (HsIdent $1) }
+op    :: { HsName }
+      : varop                 { $1 }
+      | conop                 { $1 }
hunk ./FrontEnd/HsParser.y 788
-> qconsym :: { HsName }
->	: consym		{  $1 }
->	| QCONSYM		{ Qual (Module (fst $1)) (hsSymbol (snd $1)) }
+qop   :: { HsExp }
+      : qvarop                { HsVar $1 }
+      | qconop                { HsCon $1 }
hunk ./FrontEnd/HsParser.y 792
-> consym :: { HsName }
->	: CONSYM		{ UnQual (hsSymbol $1) }
+qopm  :: { HsExp }
+      : qvaropm               { HsVar $1 }
+      | qconop                { HsCon $1 }
hunk ./FrontEnd/HsParser.y 796
-> qvarsym :: { HsName }
->	: varsym		{ $1 }
->	| qvarsym1		{ $1 }
+qvarid :: { HsName }
+      : varid                 {  $1 }
+      | QVARID                { Qual (Module (fst $1)) (HsIdent (snd $1)) }
hunk ./FrontEnd/HsParser.y 800
-> qvarsymm :: { HsName }
->	: varsymm		{ $1 }
->	| qvarsym1		{ $1 }
+varid :: { HsName }
+      : VARID                 { UnQual (HsIdent $1) }
+      | 'as'                  { as_name }
+      | 'qualified'           { qualified_name }
+      | 'hiding'              { hiding_name }
hunk ./FrontEnd/HsParser.y 806
-> varsym :: { HsName }
->	: VARSYM		{ UnQual (hsSymbol $1) }
->	| '-'			{ minus_name }
->	| '!'			{ pling_name }
->	| '*'			{ star_name }
->	| '.'			{ dot_name }
+qconid :: { HsName }
+      : conid                 {  $1 }
+      | QCONID                { Qual (Module (fst $1)) (HsIdent (snd $1)) }
hunk ./FrontEnd/HsParser.y 810
-> varsymm :: { HsName } -- varsym not including '-'
->	: VARSYM		{ UnQual (hsSymbol $1) }
->	| '!'			{ pling_name }
->	| '*'			{ star_name }
->	| '.'			{ dot_name }
+conid :: { HsName }
+      : CONID                 { UnQual (HsIdent $1) }
hunk ./FrontEnd/HsParser.y 813
-> qvarsym1 :: { HsName }
->	: QVARSYM		{ Qual (Module (fst $1)) (hsSymbol (snd $1)) }
+qconsym :: { HsName }
+      : consym                {  $1 }
+      | QCONSYM               { Qual (Module (fst $1)) (hsSymbol (snd $1)) }
hunk ./FrontEnd/HsParser.y 817
-> literal :: { HsExp }
->	: INT 			{ HsLit (HsInt (readInteger $1)) }
->	| CHAR 			{ HsLit (HsChar $1) }
->	| RATIONAL		{ HsLit (HsFrac (readRational $1)) }
->	| STRING		{ HsLit (HsString $1) }
+consym :: { HsName }
+      : CONSYM                { UnQual (hsSymbol $1) }
hunk ./FrontEnd/HsParser.y 820
->  srcloc :: { SrcLoc }	:	{% getSrcLoc }
+qvarsym :: { HsName }
+      : varsym                { $1 }
+      | qvarsym1              { $1 }
hunk ./FrontEnd/HsParser.y 824
------------------------------------------------------------------------------
-Layout
+qvarsymm :: { HsName }
+      : varsymm               { $1 }
+      | qvarsym1              { $1 }
hunk ./FrontEnd/HsParser.y 828
-> close :: { () }
->	: vccurly		{ () } -- context popped in lexer.
->	| error			{% popContext }
+varsym :: { HsName }
+      : VARSYM                { UnQual (hsSymbol $1) }
+      | '-'                   { minus_name }
+      | '!'                   { pling_name }
+      | '*'                   { star_name }
+      | '.'                   { dot_name }
hunk ./FrontEnd/HsParser.y 835
-> layout_on  :: { () }	:	{% getSrcLoc `thenP` \sl ->
->				   pushCurrentContext  }
+varsymm :: { HsName } -- varsym not including '-'
+      : VARSYM                { UnQual (hsSymbol $1) }
+      | '!'                   { pling_name }
+      | '*'                   { star_name }
+      | '.'                   { dot_name }
hunk ./FrontEnd/HsParser.y 841
-				   pushCurrentContext (Layout (srcLocColumn sl)) }
+qvarsym1 :: { HsName }
+      : QVARSYM               { Qual (Module (fst $1)) (hsSymbol (snd $1)) }
hunk ./FrontEnd/HsParser.y 844
------------------------------------------------------------------------------
-Miscellaneous (mostly renamings)
+literal :: { HsExp }
+      : INT                   { HsLit (HsInt (readInteger $1)) }
+      | CHAR                  { HsLit (HsChar $1) }
+      | RATIONAL              { HsLit (HsFrac (readRational $1)) }
+      | STRING                { HsLit (HsString $1) }
hunk ./FrontEnd/HsParser.y 850
-> modid :: { Module }
->	: CONID			{ Module $1 }
->	| QCONID	       	{ Module (fst $1 ++ "." ++ snd $1) }
+ srcloc :: { SrcLoc } :       {% getSrcLoc }
hunk ./FrontEnd/HsParser.y 852
-> tyconorcls :: { HsName }
->	: conid			{ $1 }
+-- -----------------------------------------------------------------------------
+-- Layout
hunk ./FrontEnd/HsParser.y 855
-> tycon :: { HsName }
->	: conid			{ $1 }
+close :: { () }
+      : vccurly               { () } -- context popped in lexer.
+      | error                 {% popContext }
hunk ./FrontEnd/HsParser.y 859
-> qtyconorcls :: { HsName }
->	: qconid		{ $1 }
+layout_on  :: { () }  :       {% getSrcLoc `thenP` \sl ->
+                                 pushCurrentContext  }
hunk ./FrontEnd/HsParser.y 862
-> qtycls :: { HsName }
->	: qconid		{ $1 }
+--                                 pushCurrentContext (Layout (srcLocColumn sl)) }
hunk ./FrontEnd/HsParser.y 864
-> tyvar :: { HsName }
->	: varid			{ $1 }
+-- -----------------------------------------------------------------------------
+-- Miscellaneous (mostly renamings)
hunk ./FrontEnd/HsParser.y 867
------------------------------------------------------------------------------
+modid :: { Module }
+      : CONID                 { Module $1 }
+      | QCONID                { Module (fst $1 ++ "." ++ snd $1) }
hunk ./FrontEnd/HsParser.y 871
-> {
-> happyError = parseError "Parse error"
-> hsSymbol x = HsIdent x
-> readInteger x = fromIntegral x
-> readRational x = x
-> }
+tyconorcls :: { HsName }
+      : conid                 { $1 }
+
+tycon :: { HsName }
+      : conid                 { $1 }
+
+qtyconorcls :: { HsName }
+      : qconid                { $1 }
+
+qtycls :: { HsName }
+      : qconid                { $1 }
+
+tyvar :: { HsName }
+      : varid                 { $1 }
+
+-- -----------------------------------------------------------------------------
+
+{
+happyError = parseError "Parse error"
+hsSymbol x = HsIdent x
+readInteger x = fromIntegral x
+readRational x = x
+}
hunk ./Makefile 139
-FrontEnd/HsParser.hs: FrontEnd/HsParser.ly
-	happy -a -g -c FrontEnd/HsParser.ly
+FrontEnd/HsParser.hs: FrontEnd/HsParser.y
+	happy -a -g -c FrontEnd/HsParser.y