@@ -143,14 +143,14 @@ desugarImports modules = do
143-- Rethrow an error with the name of the current module in the case of a failure
143-- Rethrow an error with the name of the current module in the case of a failure
145rethrowForModule :: Module -> Either String a -> Either String a
145rethrowForModule :: Module -> Either String a -> Either String a
146−rethrowForModule (Module mn _) = flip catchError $ \e -> throwError ("Error in module '" ++ show mn ++ "':\n" ++ e)
146+rethrowForModule (Module mn _ _) = flip catchError $ \e -> throwError ("Error in module '" ++ show mn ++ "':\n" ++ e)
149-- Replaces all local names with qualified names within a module.
149-- Replaces all local names with qualified names within a module.
151renameInModule :: ImportEnvironment -> Module -> Either String Module
151renameInModule :: ImportEnvironment -> Module -> Either String Module
152−renameInModule imports (Module mn decls) =
152+renameInModule imports (Module mn decls exps) =
153− Module mn <$> mapM updateDecl decls >>= everywhereM (mkM updateType `extM` updateValue `extM` updateBinder `extM` updateVars)
153+ Module mn <$> (mapM updateDecl decls >>= everywhereM (mkM updateType `extM` updateValue `extM` updateBinder `extM` updateVars)) <*> pure exps
155 updateDecl (TypeInstanceDeclaration name cs (Qualified Nothing cn) ts ds) =
155 updateDecl (TypeInstanceDeclaration name cs (Qualified Nothing cn) ts ds) =
156 TypeInstanceDeclaration name <$> updateConstraints cs <*> updateClassName cn <*> pure ts <*> pure ds
156 TypeInstanceDeclaration name <$> updateConstraints cs <*> updateClassName cn <*> pure ts <*> pure ds
@@ -197,7 +197,7 @@ renameInModule imports (Module mn decls) =
197findExports :: [Module] -> Either String ExportEnvironment
197findExports :: [Module] -> Either String ExportEnvironment
198findExports = foldM addModule M.empty
198findExports = foldM addModule M.empty
200− addModule env m@(Module mn ds) = rethrowForModule m $ foldM (addDecl mn) (addEmptyModule env mn) ds
200+ addModule env m@(Module mn ds exps) = rethrowForModule m $ foldM (addDecl mn) (addEmptyModule env mn) ds
201 addDecl mn env (TypeClassDeclaration tcn _ ds) = do
201 addDecl mn env (TypeClassDeclaration tcn _ ds) = do
202 env' <- addTypeClass env mn tcn
202 env' <- addTypeClass env mn tcn
203 foldM (\env'' (TypeDeclaration name _) -> addValue env'' mn name) env' ds
203 foldM (\env'' (TypeDeclaration name _) -> addValue env'' mn name) env' ds
@@ -227,7 +227,7 @@ findImports = foldl findImports' M.empty
227-- Constructs a local environment for a module.
227-- Constructs a local environment for a module.
229resolveImports :: ExportEnvironment -> Module -> Either String ImportEnvironment
229resolveImports :: ExportEnvironment -> Module -> Either String ImportEnvironment
230−resolveImports env (Module currentModule decls) =
230+resolveImports env (Module currentModule decls _) =
231 foldM resolveImport' (ImportEnvironment M.empty M.empty M.empty M.empty) (M.toList scope)
231 foldM resolveImport' (ImportEnvironment M.empty M.empty M.empty M.empty) (M.toList scope)
233 -- A Map from module name to imports from that module, where Nothing indicates everything is to be imported
233 -- A Map from module name to imports from that module, where Nothing indicates everything is to be imported