@@ -56,7 +56,7 @@ findImports = foldM (go Nothing) M.empty
5656 go _ result (PositionedDeclaration pos _ d) = warnAndRethrowWithPosition pos $ go (Just pos) result d
5757 go _ result _ = return result
5858
59− -- Ensure that classes don't appear in an `import X hiding (...)`
59+ -- Ensure that modules don't appear in an `import X hiding (...)`
6060 checkImportRefType :: ImportDeclarationType -> m ()
6161 checkImportRefType (Hiding refs) = traverse_ checkImportRef refs
6262 checkImportRefType _ = return ()
@@ -129,7 +129,16 @@ resolveImport currentModule importModule exps imps impQual =
129129 resolveByType :: ImportDeclarationType -> m Imports
130130 resolveByType Implicit = importAll importExplicit
131131 resolveByType (Explicit explImports) = checkRefs explImports >> foldM importExplicit imps explImports
132− resolveByType (Hiding hiddenImports) = checkRefs hiddenImports >> importAll (importNonHidden hiddenImports)
132+ resolveByType (Hiding hiddenImports) = do
133+ checkRefs hiddenImports
134+ imps' <- importAll (importNonHidden hiddenImports)
135+ let isEmptyImport
136+ = M.null (importedTypes imps')
137+ && M.null (importedDataConstructors imps')
138+ && M.null (importedTypeClasses imps')
139+ && M.null (importedValues imps')
140+ when isEmptyImport $ tell . errorMessage $ RedundantEmptyHidingImport importModule
141+ return imps'
133142
134143 -- Check that a 'DeclarationRef' refers to an importable symbol
135144 checkRefs :: [DeclarationRef] -> m ()