[don't require 'error' to be in scope for where pattern desugaring, process renaming errors before kind inference
John Meacham <john@repetae.net>**20120206061151
 Ignore-this: 9d171d1713fd41761ce5f5e33d7406d0
] hunk ./src/FrontEnd/Desugar.hs 116
-       a2 =  HsAlt sloc HsPWildCard (HsUnGuardedRhs (HsApp (HsVar (toName Val ("error"::String))) (HsLit $ HsString $ show sloc ++ " failed pattern match"))) []
+       a2 =  HsAlt sloc HsPWildCard (HsUnGuardedRhs (HsError { hsExpSrcLoc = sloc, hsExpErrorType = HsErrorPatternFailure, hsExpString = show sloc ++ " failed pattern match" })) []
+       --a2 =  HsAlt sloc HsPWildCard (HsUnGuardedRhs (HsApp (HsVar (toName Val ("error"::String))) (HsLit $ HsString $ show sloc ++ " failed pattern match"))) []
hunk ./src/FrontEnd/HsSyn.hs 363
-data HsErrorType = HsErrorPatternFailure | HsErrorSource | HsErrorFieldSelect | HsErrorUnderscore | HsErrorUninitializedField | HsErrorRecordUpdate
+data HsErrorType
+    = HsErrorPatternFailure
+    | HsErrorSource
+    | HsErrorFieldSelect
+    | HsErrorUnderscore
+    | HsErrorUninitializedField
+    | HsErrorRecordUpdate
hunk ./src/FrontEnd/KindInfer.hs 362
-    case Map.lookup (toName ClassName n) (kindEnvClasses env) of
-        Nothing -> fail $ "unknown class: " ++ show asst
+    case Map.lookup n (kindEnvClasses env) of
+        Nothing -> do
+                addWarn (UndefinedName n) ("Incorrect number of class parameters for " ++ show asst)
+--        ,fail $ "unknown class: " ++ show asst
hunk ./src/FrontEnd/KindInfer.hs 510
-        Nothing -> error $ "kindOf: could not find kind of class : " ++ show (nameType name,name)
+        --Nothing -> error $ "kindOf: could not find kind of class : " ++ show (nameType name,name)
+        Nothing -> [] -- error $ "kindOf: could not find kind of class : " ++ show (nameType name,name)
hunk ./src/FrontEnd/Rename.hs 166
-    HsPatBind srcLoc HsPVar {hsPatName = name} rhs decls -> 
+    HsPatBind srcLoc HsPVar {hsPatName = name} rhs decls ->
hunk ./src/FrontEnd/Rename.hs 169
-        f m@HsMatch { hsMatchName } = m { hsMatchName = qualifyMethodName moduleName hsMatchName } 
+        f m@HsMatch { hsMatchName } = m { hsMatchName = qualifyMethodName moduleName hsMatchName }
hunk ./src/FrontEnd/Rename.hs 734
-    f cd@(HsClassDecl sl _ ds) = tellF $ (toName ClassName z,sl,snub $ fsts cs):[ (n,a,[]) | (n,a) <- cs]  where
-        z = case maybeGetDeclName cd of
-            Just x | nameType x == ClassName -> x
-            _ -> error "not a class name"
+    f cd@(HsClassDecl sl ch ds) = tellF $ (toName ClassName $ hsClassHead ch,sl,snub $ fsts cs):[ (n,a,[]) | (n,a) <- cs]  where
hunk ./src/FrontEnd/Tc/Module.hs 119
+    processErrors (concatMap snd mserrs)
hunk ./src/FrontEnd/Tc/Module.hs 241
-    processErrors (concatMap snd mserrs)