Skip to content

Commit

Permalink
Merge pull request haskell-hvr#2 from ekmett/master
Browse files Browse the repository at this point in the history
Allow safe imports
  • Loading branch information
hvr committed Apr 26, 2014
2 parents 151e62c + abb8e6a commit 5192667
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packunused.hs
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,11 @@ readImports outDir fn = do
extractSpecs (Just (False, impspecs)) = map H.prettyPrint impspecs
extractSpecs _ = error "unexpected import specs"

parseImportsFile = H.parseFileContentsWithMode (H.defaultParseMode { H.extensions = exts, H.parseFilename = outDir </> fn }) . stripExplicitNamespaces
parseImportsFile = H.parseFileContentsWithMode (H.defaultParseMode { H.extensions = exts, H.parseFilename = outDir </> fn }) . stripExplicitNamespaces . stripSafe

-- hack to remove -XExplicitNamespaces until haskell-src-exts supports that
stripExplicitNamespaces = unwords . splitOn " type "
stripSafe = unwords . splitOn " safe "

#if MIN_VERSION_haskell_src_exts(1,14,0)
exts = map H.EnableExtension [ H.MagicHash, H.PackageImports, H.CPP, H.TypeOperators, H.TypeFamilies {- , H.ExplicitNamespaces -} ]
Expand Down

0 comments on commit 5192667

Please sign in to comment.