@@ -58,7 +58,7 @@ findImports = foldM (go Nothing) M.empty
58 go _ result (PositionedDeclaration pos _ d) = warnAndRethrowWithPosition pos $ go (Just pos) result d
58 go _ result (PositionedDeclaration pos _ d) = warnAndRethrowWithPosition pos $ go (Just pos) result d
59 go _ result _ = return result
59 go _ result _ = return result
61− -- Ensure that classes don't appear in an `import X hiding (...)`
61+ -- Ensure that modules don't appear in an `import X hiding (...)`
62 checkImportRefType :: ImportDeclarationType -> m ()
62 checkImportRefType :: ImportDeclarationType -> m ()
63 checkImportRefType (Hiding refs) = traverse_ checkImportRef refs
63 checkImportRefType (Hiding refs) = traverse_ checkImportRef refs
64 checkImportRefType _ = return ()
64 checkImportRefType _ = return ()
@@ -171,7 +171,16 @@ resolveImport currentModule importModule exps imps impQual =
171 resolveByType :: ImportDeclarationType -> m Imports
171 resolveByType :: ImportDeclarationType -> m Imports
172 resolveByType Implicit = importAll importExplicit
172 resolveByType Implicit = importAll importExplicit
173 resolveByType (Explicit explImports) = checkRefs explImports >> foldM importExplicit imps explImports
173 resolveByType (Explicit explImports) = checkRefs explImports >> foldM importExplicit imps explImports
174+ resolveByType (Hiding hiddenImports) = do
175+ checkRefs hiddenImports
174− resolveByType (Hiding hiddenImports) = checkRefs hiddenImports >> importAll (importNonHidden hiddenImports)
176+ imps' <- importAll (importNonHidden hiddenImports)
178+ = M.null (importedTypes imps')
179+ && M.null (importedDataConstructors imps')
180+ && M.null (importedTypeClasses imps')
181+ && M.null (importedValues imps')
182+ when isEmptyImport $ tell . errorMessage $ RedundantEmptyHidingImport importModule
176 -- Check that a 'DeclarationRef' refers to an importable symbol
185 -- Check that a 'DeclarationRef' refers to an importable symbol
177 checkRefs :: [DeclarationRef] -> m ()
186 checkRefs :: [DeclarationRef] -> m ()