X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2Fparser%2FParser.y.pp;h=a72b47b27d62373ee328ae7fe74df233dcb4e610;hp=c0c783f8fed0f68abfdd0458b5a13545e27bbbcd;hb=3ad8f84f6a75f240383e62a14472d14eb372dcd1;hpb=15486d73d84483243f40fa245e63e7e88d5ed0ad diff --git a/compiler/parser/Parser.y.pp b/compiler/parser/Parser.y.pp index c0c783f..a72b47b 100644 --- a/compiler/parser/Parser.y.pp +++ b/compiler/parser/Parser.y.pp @@ -159,6 +159,7 @@ incorrect. 'deriving' { L _ ITderiving } 'do' { L _ ITdo } 'else' { L _ ITelse } + 'for' { L _ ITfor } 'hiding' { L _ IThiding } 'if' { L _ ITif } 'import' { L _ ITimport } @@ -662,6 +663,16 @@ tycl_hdr :: { Located (LHsContext RdrName, | type {% checkTyClHdr (noLoc []) $1 >>= return.L1 } ----------------------------------------------------------------------------- +-- Stand-alone deriving + +-- Glasgow extension: stand-alone deriving declarations +stand_alone_deriving :: { LDerivDecl RdrName } + : 'deriving' qtycon 'for' qtycon {% do { p <- checkInstType (fmap HsTyVar $2) + ; checkDerivDecl (LL (DerivDecl p $4)) } } + + | 'deriving' '(' inst_type ')' 'for' qtycon {% checkDerivDecl (LL (DerivDecl $3 $6)) } + +----------------------------------------------------------------------------- -- Nested declarations -- Type declaration or value declaration