[allow being explicit in export/import lists by specifying 'kind', 'class', 'type', or 'data'. add PTS rule to allow proper typing of Complex_
John Meacham <john@repetae.net>**20120211052157
 Ignore-this: 12155286186022f896d3474a2bb5d23a
] hunk ./src/E/TypeCheck.hs 90
-       (**,##,##)  -- Array__ a :: #
+       (**,##,##)  -- MutArray_ :: * -> #
+       (##,##,##)  -- Complex_ :: # -> #
hunk ./src/E/TypeCheck.hs 175
-        ([EStarStar],[EHashHash],EHashHash)
+        ([EStarStar],[EHashHash],EHashHash),
+        ([EHashHash],[EHashHash],EHashHash)
hunk ./src/FrontEnd/Exports.hs 113
-                    let listed = mconcat $ map (entSpec isHiding es . importToExport) xs
+                    let listed = mconcat $ map (entSpec isHiding es) xs
hunk ./src/FrontEnd/Exports.hs 120
-        Bool     -- ^ is it a hiding import?
+        Bool              -- ^ is it a hiding import?
hunk ./src/FrontEnd/Exports.hs 124
-    entSpec isHiding rel (HsEVar n) = restrictDomainS (toName Val n) rel
-    entSpec isHiding rel (HsEAbs n) = restrictDomainSet (Set.fromList [ toName x n | x <- ts]) rel  where
-        ts = TypeConstructor:ClassName:if isHiding then [DataConstructor] else []
-    entSpec isHiding rel (HsEThingWith n xs) = restrictDomainSet (fromList (concat (ct:(map cd xs)))) rel where
-        ct = [toName TypeConstructor n, toName ClassName n]
-        cd n =  [toName DataConstructor n, toName Val n, toName FieldLabel n ]
-    entSpec isHiding rel (HsEThingAll n) = rdl `mappend` restrictRange (`elem` ss) rel where
-        ct = [toName TypeConstructor n, toName ClassName n]
-        ss = concat $ concat [ maybeToList (Map.lookup x ownsMap) | x <- Set.toList $ range rdl ]
-        cd n =  [toName DataConstructor n, toName Val n, toName FieldLabel n ]
-        rdl = (restrictDomain (`elem` ct) rel)
+    entSpec isHiding rel e = f Nothing e where
+	f _ (HsEVar n) = restrictDomainS (toName Val n) rel
+	f Nothing (HsEAbs n) = restrictDomainSet (Set.fromList [ toName x n | x <- ts]) rel  where
+	    ts = TypeConstructor:ClassName:if isHiding then [DataConstructor] else []
+	f (Just nt) (HsEAbs n) = restrictDomainSet (Set.singleton (toName nt n)) rel  where
+	f mnt (HsEThingWith n xs) = restrictDomainSet (fromList (concat (map (`toName` n) ct:(map cd xs)))) rel where
+	    ct = case mnt of
+		Nothing -> [TypeConstructor,ClassName]
+		Just nt -> [nt]
+	    cd n =  [toName DataConstructor n, toName Val n, toName FieldLabel n ]
+	f mnt (HsEThingAll n) = rdl `mappend` restrictRange (`elem` ss) rel where
+	    ct = case mnt of
+		Nothing -> [TypeConstructor,ClassName]
+		Just nt -> [nt]
+	    ss = concat $ concat [ maybeToList (Map.lookup x ownsMap) | x <- Set.toList $ range rdl ]
+	    cd n = [toName DataConstructor n, toName Val n, toName FieldLabel n ]
+	    rdl = (restrictDomain (`elem` map (`toName` n) ct) rel)
+	f _ (HsEQualified t n) = f (Just t) n
hunk ./src/FrontEnd/Exports.hs 145
-
-importToExport :: HsImportSpec -> HsExportSpec
-importToExport x = f x where
-    f (HsIVar n) = HsEVar n
-    f (HsIAbs n) = HsEAbs n
-    f (HsIThingAll n) = HsEThingAll n
-    f (HsIThingWith n xs) = HsEThingWith n xs
hunk ./src/FrontEnd/HsParser.y 235
-maybeimpspec :: { Maybe (Bool, [HsImportSpec]) }
+maybeimpspec :: { Maybe (Bool, [HsExportSpec]) }
hunk ./src/FrontEnd/HsParser.y 239
-impspec :: { (Bool, [HsImportSpec]) }
+impspec :: { (Bool, [HsExportSpec]) }
hunk ./src/FrontEnd/HsParser.y 245
-importlist :: { [HsImportSpec] }
+importlist :: { [HsExportSpec] }
hunk ./src/FrontEnd/HsParser.y 249
-import :: { HsImportSpec }
-      :  var                                  { HsIVar $1 }
-      |  tyconorcls                           { HsIAbs $1 }
-      |  tyconorcls '(' '..' ')'              { HsIThingAll $1 }
-      |  tyconorcls '(' ')'                   { HsIThingWith $1 [] }
-      |  tyconorcls '(' cnames ')'            { HsIThingWith $1 (reverse $3) }
+import :: { HsExportSpec }
+      :  var                                  { HsEVar $1 }
+      |  tyconorcls                           { HsEAbs $1 }
+      |  tyconorcls '(' '..' ')'              { HsEThingAll $1 }
+      |  tyconorcls '(' ')'                   { HsEThingWith $1 [] }
+      |  tyconorcls '(' cnames ')'            { HsEThingWith $1 (reverse $3) }
+      |  'class' import                       { HsEQualified ClassName $2 }
+      |  'type'  import                       { HsEQualified TypeConstructor $2 }
+      |  'kind'  import                       { HsEQualified SortName $2 }
hunk ./src/FrontEnd/HsPretty.hs 195
-ppHsExportSpec (HsEVar name)                     = ppHsQNameParen name
-ppHsExportSpec (HsEAbs name)                     = ppHsQName name
-ppHsExportSpec (HsEThingAll name)                = ppHsQName name <> text"(..)"
-ppHsExportSpec (HsEThingWith name nameList)      = ppHsQName name <>
-                                                   (parenList . map ppHsQNameParen $ nameList)
-ppHsExportSpec (HsEModuleContents (show -> name)) = text "module" <+> text name
+ppHsExportSpec e = f e where
+    f (HsEVar name)                     = ppHsQNameParen name
+    f (HsEAbs name)                     = ppHsQName name
+    f (HsEThingAll name)                = ppHsQName name <> text"(..)"
+    f (HsEThingWith name nameList)      = ppHsQName name <> (parenList . map ppHsQNameParen $ nameList)
+    f (HsEModuleContents (show -> name)) = text "module" <+> text name
+    f (HsEQualified ClassName e)         = text "class" <+> ppHsExportSpec e
+    f (HsEQualified SortName e)          = text "kind" <+> ppHsExportSpec e
+    f (HsEQualified TypeConstructor e)   = text "type" <+> ppHsExportSpec e
+    f (HsEQualified DataConstructor e)   = text "data" <+> ppHsExportSpec e
+    f (HsEQualified n e)                 = tshow n <+> ppHsExportSpec e
hunk ./src/FrontEnd/HsPretty.hs 207
+
+tshow = text . show
hunk ./src/FrontEnd/HsPretty.hs 217
-	    | b = text "hiding" <+> (parenList . map ppHsImportSpec $ specList)
-	    | otherwise = parenList . map ppHsImportSpec $  specList
+	    | b = text "hiding" <+> (parenList . map ppHsExportSpec $ specList)
+	    | otherwise = parenList . map ppHsExportSpec $  specList
hunk ./src/FrontEnd/HsPretty.hs 220
-ppHsImportSpec :: HsImportSpec -> Doc
-ppHsImportSpec (HsIVar name)                     = ppHsNameParen name
-ppHsImportSpec (HsIAbs name)                     = ppHsName name
-ppHsImportSpec (HsIThingAll name)                = ppHsName name <> text"(..)"
-ppHsImportSpec (HsIThingWith name nameList)      = ppHsName name <>
-                                                   (parenList . map ppHsNameParen $ nameList)
hunk ./src/FrontEnd/HsSyn.hs 52
-	 = HsEVar HsName		-- variable
-	 | HsEAbs HsName		-- T
-	 | HsEThingAll HsName		-- T(..)
-	 | HsEThingWith HsName [HsName]	-- T(C_1,...,C_n)
-	 | HsEModuleContents Module	-- module M   (not for imports)
+    = HsEVar HsName                      -- variable
+    | HsEAbs HsName                      -- T
+    | HsEThingAll HsName                 -- T(..)
+    | HsEThingWith HsName [HsName]       -- T(C_1,...,C_n)
+    | HsEModuleContents Module           -- module M   (not for imports)
+    | HsEQualified NameType HsExportSpec -- class Foo, type Bar, kind ANY
hunk ./src/FrontEnd/HsSyn.hs 68
-    hsImportDeclSpec :: (Maybe (Bool,[HsImportSpec]))
+    hsImportDeclSpec :: (Maybe (Bool,[HsExportSpec]))
hunk ./src/FrontEnd/HsSyn.hs 72
-data HsImportSpec
-	 = HsIVar HsName		-- variable
-	 | HsIAbs HsName		-- T
-	 | HsIThingAll HsName		-- T(..)
-	 | HsIThingWith HsName [HsName]	-- T(C_1,...,C_n)
-  deriving(Eq,Show)
-