[move denewtying into E generation. make creating class rules work with no defaults, create placeholders when converting class rather than as seperate pass
John Meacham <john@repetae.net>**20060211212100] hunk ./E/FromHs.hs 7
-    deNewtype,
hunk ./E/FromHs.hs 10
-    methodNames,
hunk ./E/FromHs.hs 179
-
-    method classRecord n = as where
+    method classRecord methodName = as where
hunk ./E/FromHs.hs 181
-        methodName =  n
-        Identity (deftvr@(TVr { tvrType = ty}),_) = findName defaultName
-        defaultName =  (defaultInstanceName n)
+        Identity (TVr {tvrType = ty},_) = findName methodName
+        defaultName =  (defaultInstanceName methodName)
hunk ./E/FromHs.hs 188
-            name = ((instanceName n (getTypeCons t)))
+            name = ((instanceName methodName (getTypeCons t)))
hunk ./E/FromHs.hs 190
-            body = case findName name of Just (n,_) -> foldl EAp (EVar n) vs  ; Nothing -> EAp (EVar deftvr) (valToPat' (tipe t))
+            body = case findName name of
+                Just (n,_) -> foldl EAp (EVar n) vs
+                Nothing -> case findName defaultName of
+                    Just (deftvr,_) -> EAp (EVar deftvr) (valToPat' (tipe t))
+                    Nothing -> EError ( show methodName ++ ": undefined at type " ++  PPrint.render (pprint t)) (eAp ty (valToPat' (tipe t)))
hunk ./E/FromHs.hs 287
-        | "Instance@" `isPrefixOf` show a = (a,setProperty prop_INSTANCE b, c)
-        | otherwise = (a,b,c)
+        | "Instance@" `isPrefixOf` show a = (a,setProperty prop_INSTANCE b, deNewtype dataTable c)
+        | otherwise = (a,b, deNewtype dataTable c)
hunk ./E/FromHs.hs 444
-        ans = concatMap method [  n | n :>: _ <- classAssumps cr]
+        ans = cClass cr ++ concatMap method [  n | n :>: _ <- classAssumps cr]
hunk ./E/FromHs.hs 451
+        cClass classRecord =  [ f n (nameToInt n) (convertOneVal t) | n :>: t <- classAssumps classRecord ] where
+            f n i t = (n,setProperties [prop_METHOD,prop_PLACEHOLDER] $ tVr i t, EPrim (primPrim ("Placeholder: " ++ show n)) [] t)
hunk ./Main.hs 15
-import C.Prims
hunk ./Main.hs 178
-    ds' <- convertDecls (hoClassHierarchy ho') allAssumps  fullDataTable decls
-    let mnames = methodNames (hoClassHierarchy ho')
-        ds = ds' ++ [ (runIdentity $ fromId (tvrIdent t),setProperties [prop_PLACEHOLDER] t, EPrim (primPrim ("Placeholder: " ++ tvrShowName t)) [] (getType t)) | t <- mnames, not $ t `Set.member` cnames]
-        cnames = Set.fromList $ fsts $ Map.elems $ hoEs ho
+    ds <- convertDecls (hoClassHierarchy ho') allAssumps  fullDataTable decls
hunk ./Main.hs 189
-    let inscope =  [ tvrIdent n | (n,_) <- Map.elems $ hoEs ho ] ++ [tvrIdent n | (_,n,_) <- ds ] ++ map tvrIdent (methodNames (hoClassHierarchy allHo))
+    let inscope =  [ tvrIdent n | (n,_) <- Map.elems $ hoEs ho ] ++ [tvrIdent n | (_,n,_) <- ds ]
hunk ./Main.hs 191
-        classNames = Set.fromList $ map tvrIdent (methodNames (hoClassHierarchy allHo))
-        namesInscope = Set.fromList inscope -- classNames `Set.union` (Set.fromAscList $ Map.keys smap)
+        namesInscope = Set.fromList inscope
hunk ./Main.hs 292
-    return ho' { hoDataTable = dataTable, hoEs = programEsMap prog , hoRules = hoRules ho' `mappend` rules, hoUsedIds = collectIds (ELetRec [ (b,c) | (_,b,c) <- ds'] Unknown) }
+    return ho' { hoDataTable = dataTable, hoEs = programEsMap prog , hoRules = hoRules ho' `mappend` rules, hoUsedIds = collectIds (ELetRec (programDs prog) Unknown) }
hunk ./Main.hs 314
-    lc <- mangle (return ()) False "deNewtype" (return . deNewtype dataTable) lc
+    --lc <- mangle (return ()) False "deNewtype" (return . deNewtype dataTable) lc