graphmod 1.4.2 → 1.4.3
raw patch · 3 files changed
+22/−20 lines, 3 filesdep ~haskell-lexer
Dependency ranges changed: haskell-lexer
Files
- graphmod.cabal +7/−11
- src/Main.hs +13/−7
- src/Utils.hs +2/−2
graphmod.cabal view
@@ -1,25 +1,20 @@ name: graphmod-version: 1.4.2+version: 1.4.3 license: BSD3 license-file: LICENSE author: Iavor S. Diatchki maintainer: iavor.diatchki@gmail.com homepage: http://github.com/yav/graphmod/wiki build-type: Simple-cabal-version: >= 1.6+cabal-version: >= 1.10 synopsis: Present the module dependencies of a program as a "dot" graph. description: This package contains a program that computes "dot" graphs from the dependencies of a number of Haskell modules. category: Development -tested-with: GHC==7.0.1, GHC==7.0.2, GHC==7.0.3, GHC==7.0.4,- GHC==7.2.1, GHC==7.2.2,- GHC==7.4.1, GHC==7.4.2,- GHC==7.6.1, GHC==7.6.2, GHC==7.6.3,- GHC==7.8.1, GHC==7.8.2, GHC==7.8.3, GHC==7.8.4- GHC==7.10.1, GHC==7.10.2, GHC==7.10.3- GHC==8.0.1, GHC==8.0.2,- GHC==8.2.1+tested-with: GHC==8.0.1, GHC==8.0.2,+ GHC==8.2.1,+ GHC==8.6.3, GHC==8.6.4 extra-source-files: CHANGELOG.md @@ -27,9 +22,10 @@ main-is: Main.hs other-modules: Utils, Trie, Paths_graphmod, CabalSupport build-depends: base < 5, directory, filepath, dotgen >= 0.2 && < 0.5,- haskell-lexer >= 1.0.1, containers, Cabal, pretty+ haskell-lexer >= 1.0.2, containers, Cabal, pretty hs-source-dirs: src ghc-options: -Wall -O2+ default-language: Haskell2010 source-repository head type: git
src/Main.hs view
@@ -216,15 +216,21 @@ -- NOTE: We use the Maybe type to indicate when things changed. collapse :: Opts -> Nodes -> (Qualifier,Bool) -> Maybe Nodes-collapse _ _ ([],_) = return Trie.empty -- Probably not terribly useful.+collapse _ _ ([],_) = Nothing -collapse opts (Trie.Sub ts mb) ([q],alsoMod) =+collapse opts (Trie.Sub ts mb) ([q],alsoMod') = do t <- Map.lookup q ts- let will_move = mod_in_cluster opts && Map.member q ts+ let alsoMod = alsoMod' || mod_in_cluster opts+ -- if modules are moved in their sub-directory clsuter,+ -- then we always want to collapse them, irrspective of the flag given+++ nestedMods = [ nm | Trie.Sub _ (Just xs) <- Map.elems ts+ , ((_,nm),_) <- xs ]+ will_move = mod_in_cluster opts && (q `elem` nestedMods) (thisMod,otherMods)- | alsoMod || will_move = case findThisMod =<< mb of- Nothing -> (Nothing, [])- Just (nid,rest) -> (Just nid, rest)+ | alsoMod || will_move+ , Just (nid,rest) <- findThisMod =<< mb = (Just nid, rest) | otherwise = (Nothing, fromMaybe [] mb) -- use this node-id to represent the collapsed cluster@@ -246,7 +252,7 @@ msum (fmap snd (listToMaybe =<< ms) : map getFirst (Map.elems ts1)) collapse opts (Trie.Sub ts ms) (q : qs,x) =- do t <- Map.lookup q ts+ do t <- Map.lookup q ts t1 <- collapse opts t (qs,x) return (Trie.Sub (Map.insert q t1 ts) ms)
src/Utils.hs view
@@ -18,7 +18,7 @@ import Control.Monad(mplus) import Control.Exception(evaluate) import Data.Maybe(catMaybes)-import Data.List(intersperse,isPrefixOf)+import Data.List(intersperse,isPrefixOf,nub) import System.Directory(doesFileExist) import System.FilePath @@ -152,7 +152,7 @@ -- | The files in which a module might reside. -- We report only files that exist. modToFile :: [FilePath] -> ModName -> IO [FilePath]-modToFile dirs m = catMaybes `fmap` mapM check paths+modToFile dirs m = (nub . catMaybes) `fmap` mapM check paths where paths = [ d </> r | d <- dirs, r <- relPaths m ] check p = do x <- doesFileExist p