@@ -71,6 +71,9 @@ mergeSchemes schmss = do (ass,css,sss) <- unzip3 `liftM` mapM split kvs
72 , Map.fromList ps )
72 , Map.fromList ps )
74+--constrain :: Map.Map String Scheme
76+-- -> GuidCounter (Either String Constraints)
74constrain typeHints (Module _ _ imports stmts) = do
77constrain typeHints (Module _ _ imports stmts) = do
75 (ass,css,schemess) <- unzip3 `liftM` mapM stmtGen stmts
78 (ass,css,schemess) <- unzip3 `liftM` mapM stmtGen stmts
76 aliasHints <- getAliases imports `liftM` typeHints
79 aliasHints <- getAliases imports `liftM` typeHints
@@ -86,8 +89,8 @@ constrain typeHints (Module _ _ imports stmts) = do
86 escapees = Map.keys $ Map.difference assumptions allHints
89 escapees = Map.keys $ Map.difference assumptions allHints
87 msg = "Warning! Type-checker could not find variables:\n" ++ intercalate ", " escapees
90 msg = "Warning! Type-checker could not find variables:\n" ++ intercalate ", " escapees
88 return $ case escapees of
91 return $ case escapees of
89− [] -> Right (constraints ++ cs)
92+ [] -> Right (schemess, constraints ++ cs)
90− _ -> unsafePerformIO (putStrLn msg) `seq` Right (constraints ++ cs)
93+ _ -> unsafePerformIO (putStrLn msg) `seq` Right (schemess, constraints ++ cs)
91 --_ -> Left ("Undefined variable(s): " ++ intercalate ", " escapees)
94 --_ -> Left ("Undefined variable(s): " ++ intercalate ", " escapees)
93type TVarMap = Map.Map String [X]
96type TVarMap = Map.Map String [X]