[add HsClassHead type to represent class heads (rather than using HsQualType)
John Meacham <john@repetae.net>**20080218093414] hunk ./FrontEnd/HsParser.y 299
-      | 'derive' 'instance' srcloc ctype
+      | 'derive' 'instance' srcloc classhead
hunk ./FrontEnd/HsParser.y 465
+classhead :: { HsClassHead }
+    : ctype {% qualTypeToClassHead $1 }
+
hunk ./FrontEnd/HsSyn.hs 189
-    | HsClassDecl	 { hsDeclSrcLoc :: SrcLoc, hsDeclQualType :: HsQualType, hsDeclDecls :: [HsDecl] }
+    | HsClassDecl   { hsDeclSrcLoc :: SrcLoc, hsDeclQualType :: HsQualType, hsDeclDecls :: [HsDecl] }
hunk ./FrontEnd/HsSyn.hs 223
-    | HsDeclDeriving { hsDeclSrcLoc :: SrcLoc, hsDeclQualType :: HsQualType }
+    | HsDeclDeriving { hsDeclSrcLoc :: SrcLoc, hsDeclClassHead :: HsClassHead }
hunk ./FrontEnd/HsSyn.hs 377
+data HsClassHead = HsClassHead { hsClassHeadContext :: HsContext, hsClassHead :: HsName, hsClassHeadArgs :: [HsType] }
+ deriving(Eq,Show)
+    {-! derive: update !-}
+
hunk ./FrontEnd/ParseUtils.hs 32
+        , qualTypeToClassHead
hunk ./FrontEnd/ParseUtils.hs 64
+qualTypeToClassHead :: HsQualType -> P HsClassHead
+qualTypeToClassHead qt = do
+    let fromHsTypeApp t = f t [] where
+            f (HsTyApp a b) rs = f a (b:rs)
+            f t rs = (t,rs)
+    case fromHsTypeApp $ hsQualTypeType qt of
+        (HsTyCon className,as) -> return HsClassHead { hsClassHeadContext = hsQualTypeContext qt, hsClassHead = className, hsClassHeadArgs = as }
+        _ -> fail "Invalid Class Head"
+