@@ -209,7 +209,7 @@ renameInModule imports exports (Module mn decls exps) =
209 bindFunctionArgs (pos, bound) (BinaryNoParens name'@(Qualified (Just _) _) v1 v2) =
209 bindFunctionArgs (pos, bound) (BinaryNoParens name'@(Qualified (Just _) _) v1 v2) =
210 (,) (pos, bound) <$> (BinaryNoParens <$> updateValueName name' pos <*> pure v1 <*> pure v2)
210 (,) (pos, bound) <$> (BinaryNoParens <$> updateValueName name' pos <*> pure v1 <*> pure v2)
211 bindFunctionArgs pb other = return (pb, other)
211 bindFunctionArgs pb other = return (pb, other)
213 bindBinders :: (Maybe SourcePos, [Ident]) -> CaseAlternative -> Either ErrorStack ((Maybe SourcePos, [Ident]), CaseAlternative)
213 bindBinders :: (Maybe SourcePos, [Ident]) -> CaseAlternative -> Either ErrorStack ((Maybe SourcePos, [Ident]), CaseAlternative)
214 bindBinders (pos, bound) c@(CaseAlternative bs _ _) = return ((pos, binderNames bs ++ bound), c)
214 bindBinders (pos, bound) c@(CaseAlternative bs _ _) = return ((pos, binderNames bs ++ bound), c)
@@ -245,7 +245,7 @@ renameInModule imports exports (Module mn decls exps) =
245 updateType pos (SaturatedTypeSynonym name tys) = (,) <$> pure pos <*> (SaturatedTypeSynonym <$> updateTypeName name pos <*> updateType' tys)
245 updateType pos (SaturatedTypeSynonym name tys) = (,) <$> pure pos <*> (SaturatedTypeSynonym <$> updateTypeName name pos <*> updateType' tys)
246 updateType pos (ConstrainedType cs t) = (,) <$> pure pos <*> (ConstrainedType <$> updateConstraints pos cs <*> pure t)
246 updateType pos (ConstrainedType cs t) = (,) <$> pure pos <*> (ConstrainedType <$> updateConstraints pos cs <*> pure t)
247 updateType pos t = return (pos, t)
247 updateType pos t = return (pos, t)
249 updateType' :: Data d => d -> Either ErrorStack d
249 updateType' :: Data d => d -> Either ErrorStack d
250 updateType' = everywhereWithContextM' Nothing (mkS updateType)
250 updateType' = everywhereWithContextM' Nothing (mkS updateType)
@@ -301,7 +301,7 @@ findExports = foldM addModule $ M.singleton (ModuleName [ProperName "Prim"]) pri
302 -- Add a declaration from a module to the global export environment
302 -- Add a declaration from a module to the global export environment
303 addDecl :: ModuleName -> ExportEnvironment -> Declaration -> Either ErrorStack ExportEnvironment
303 addDecl :: ModuleName -> ExportEnvironment -> Declaration -> Either ErrorStack ExportEnvironment
304− addDecl mn env (TypeClassDeclaration tcn _ ds) = do
304+ addDecl mn env (TypeClassDeclaration tcn _ _ ds) = do
305 env' <- addTypeClass env mn tcn
305 env' <- addTypeClass env mn tcn
306 foldM (\env'' (TypeDeclaration name _) -> addValue env'' mn name) env' ds
306 foldM (\env'' (TypeDeclaration name _) -> addValue env'' mn name) env' ds
307 addDecl mn env (DataDeclaration tn _ dcs) = addType env mn tn (map fst dcs)
307 addDecl mn env (DataDeclaration tn _ dcs) = addType env mn tn (map fst dcs)
@@ -389,14 +389,14 @@ resolveImports :: ExportEnvironment -> Module -> Either ErrorStack ImportEnviron
389resolveImports env (Module currentModule decls _) =
389resolveImports env (Module currentModule decls _) =
390 foldM resolveImport' (ImportEnvironment M.empty M.empty M.empty M.empty) (M.toList scope)
390 foldM resolveImport' (ImportEnvironment M.empty M.empty M.empty M.empty) (M.toList scope)
393 -- A Map from module name to the source position for the import, the list of imports from that
393 -- A Map from module name to the source position for the import, the list of imports from that
394 -- module (where Nothing indicates everything is to be imported), and optionally a qualified name
394 -- module (where Nothing indicates everything is to be imported), and optionally a qualified name
395 -- for the module
395 -- for the module
396 scope :: M.Map ModuleName (Maybe SourcePos, Maybe ExplicitImports, Maybe ModuleName)
396 scope :: M.Map ModuleName (Maybe SourcePos, Maybe ExplicitImports, Maybe ModuleName)
397 scope = M.insert currentModule (Nothing, Nothing, Nothing) (findImports decls)
397 scope = M.insert currentModule (Nothing, Nothing, Nothing) (findImports decls)
399− resolveImport' :: ImportEnvironment -> (ModuleName, (Maybe SourcePos, Maybe ExplicitImports, Maybe ModuleName)) -> Either ErrorStack ImportEnvironment
399+ resolveImport' :: ImportEnvironment -> (ModuleName, (Maybe SourcePos, Maybe ExplicitImports, Maybe ModuleName)) -> Either ErrorStack ImportEnvironment
400 resolveImport' imp (mn, (pos, explImports, impQual)) = do
400 resolveImport' imp (mn, (pos, explImports, impQual)) = do
401 modExports <- positioned $ maybe (throwError $ mkErrorStack ("Cannot import unknown module '" ++ show mn ++ "'") Nothing) return $ mn `M.lookup` env
401 modExports <- positioned $ maybe (throwError $ mkErrorStack ("Cannot import unknown module '" ++ show mn ++ "'") Nothing) return $ mn `M.lookup` env
402 positioned $ resolveImport currentModule mn modExports imp impQual explImports
402 positioned $ resolveImport currentModule mn modExports imp impQual explImports