@@ -58,7 +58,7 @@ findImports = foldM (go Nothing) M.empty
5858 go _ result (PositionedDeclaration pos _ d) = warnAndRethrowWithPosition pos $ go (Just pos) result d
5959 go _ result _ = return result
6060
61− -- Ensure that classes don't appear in an `import X hiding (...)`
61+ -- Ensure that modules don't appear in an `import X hiding (...)`
6262 checkImportRefType :: ImportDeclarationType -> m ()
6363 checkImportRefType (Hiding refs) = traverse_ checkImportRef refs
6464 checkImportRefType _ = return ()
@@ -171,7 +171,16 @@ resolveImport currentModule importModule exps imps impQual =
171171 resolveByType :: ImportDeclarationType -> m Imports
172172 resolveByType Implicit = importAll importExplicit
173173 resolveByType (Explicit explImports) = checkRefs explImports >> foldM importExplicit imps explImports
174− resolveByType (Hiding hiddenImports) = checkRefs hiddenImports >> importAll (importNonHidden hiddenImports)
174+ resolveByType (Hiding hiddenImports) = do
175+ checkRefs hiddenImports
176+ imps' <- importAll (importNonHidden hiddenImports)
177+ let isEmptyImport
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
183+ return imps'
175184
176185 -- Check that a 'DeclarationRef' refers to an importable symbol
177186 checkRefs :: [DeclarationRef] -> m ()