From: simonpj Date: Mon, 5 Apr 2004 07:54:39 +0000 (+0000) Subject: [project @ 2004-04-05 07:54:39 by simonpj] X-Git-Tag: Initial_conversion_from_CVS_complete~1916 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=85bcfc6cceb83004785e3cd2c944bac97906c569;p=ghc-hetmet.git [project @ 2004-04-05 07:54:39 by simonpj] Fix parsing bug in new deriving stuff, which was killing the HEAD --- diff --git a/ghc/compiler/parser/Parser.y.pp b/ghc/compiler/parser/Parser.y.pp index 49eefb3..dbe8eb6 100644 --- a/ghc/compiler/parser/Parser.y.pp +++ b/ghc/compiler/parser/Parser.y.pp @@ -898,8 +898,15 @@ strict_mark :: { Located HsBang } : '!' { L1 HsStrict } | '{-# UNPACK' '#-}' '!' { LL HsUnbox } +-- We allow the odd-looking 'inst_type' in a deriving clause, so that +-- we can do deriving( forall a. C [a] ) in a newtype (GHC extension). +-- The 'C [a]' part is converted to an HsPredTy by checkInstType +-- We don't allow a context, but that's sorted out by the type checker. deriving :: { Located (Maybe [LHsType RdrName]) } : {- empty -} { noLoc Nothing } + | 'deriving' qtycon {% do { let { L loc tv = $2 } + ; p <- checkInstType (L loc (HsTyVar tv)) + ; return (LL (Just [p])) } } | 'deriving' '(' ')' { LL (Just []) } | 'deriving' '(' inst_types1 ')' { LL (Just $3) } -- Glasgow extension: allow partial