ghc-imported-from 0.2.0.6 → 0.2.0.7
raw patch · 4 files changed
+52/−27 lines, 4 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- Language/Haskell/GhcImportedFrom.hs +36/−21
- README.md +6/−1
- changelog.md +5/−0
- ghc-imported-from.cabal +5/−5
Language/Haskell/GhcImportedFrom.hs view
@@ -851,33 +851,48 @@ then symbol' else modName (head smatches) ++ "." ++ symbol - GhcMonad.liftIO $ putStrLn $ "symbol'': " ++ symbol''+ -- Sometimes our attempt to resolve symbol to symbol'' fails, e.g. in a Yesod 1.4 project+ -- I had "Database.Persist.Sql.createPoolConfig" which resolved to "Database.Persist.Class.PersistConfig.createPoolConfig".+ -- So here we try with the original symbol provided by the user (which might have been a fully qualified name) and then+ -- our attempt at resolving it. So many corner cases :(+ r1 <- rest ghcOpts0 ghcpkgOptions allGhcOpts targetFile targetModule smatches haskellModuleNames' haskellModules symbol symbol+ r2 <- rest ghcOpts0 ghcpkgOptions allGhcOpts targetFile targetModule smatches haskellModuleNames' haskellModules symbol symbol'' - let allJust (a, b, c, d) = isJust a && isJust b && isJust c && isJust d+ return $ case (r1, r2) of+ (Right r1', _) -> Right r1'+ (Left _, Right r2') -> Right r2'+ (Left l1, _) -> Left l1+ (_, Left l2) -> Left l2 - -- Then this does a runGhc as well.- final1 <- lookupSymbol (GhcOptions ghcOpts0) targetFile targetModule symbol'' haskellModuleNames'+rest ghcOpts0 ghcpkgOptions allGhcOpts targetFile targetModule smatches haskellModuleNames' haskellModules symbol symbol'' = do - final1' <- GhcMonad.liftIO $ concatMapM (findHaddockModule symbol'' smatches allGhcOpts ghcpkgOptions) final1- GhcMonad.liftIO $ putStrLn $ "final1': " ++ show final1'+ GhcMonad.liftIO $ putStrLn $ "symbol'': " ++ symbol'' - -- Remove any modules that have this name hidden.- -- e.g. import Data.List hiding (map)- let final1'' = filter (\(a,_,_,_) -> case a of Just a' -> not $ any (isHidden symbol a') haskellModules- Nothing -> False) final1'- GhcMonad.liftIO $ putStrLn $ "final1'': " ++ show final1''- GhcMonad.liftIO $ putStrLn $ show (symbol, haskellModules)+ let allJust (a, b, c, d) = isJust a && isJust b && isJust c && isJust d - let final2 = filter allJust final1''- final3 <- GhcMonad.liftIO $ mapM matchToUrl final2+ -- Then this does a runGhc as well.+ final1 <- lookupSymbol (GhcOptions ghcOpts0) targetFile targetModule symbol'' haskellModuleNames' - GhcMonad.liftIO $ putStrLn "last bits 5..."- if null final3- then do yyy''' <- actualFinalCase ghcOpts0 ghcpkgOptions targetFile targetModule symbol haskellModuleNames'- if null yyy'''- then return $ Left $ "No matches found."- else return $ Right yyy'''- else return $ Right final3+ final1' <- GhcMonad.liftIO $ concatMapM (findHaddockModule symbol'' smatches allGhcOpts ghcpkgOptions) final1+ GhcMonad.liftIO $ putStrLn $ "final1': " ++ show final1'++ -- Remove any modules that have this name hidden.+ -- e.g. import Data.List hiding (map)+ let final1'' = filter (\(a,_,_,_) -> case a of Just a' -> not $ any (isHidden symbol a') haskellModules+ Nothing -> False) final1'+ GhcMonad.liftIO $ putStrLn $ "final1'': " ++ show final1''+ GhcMonad.liftIO $ putStrLn $ show (symbol, haskellModules)++ let final2 = filter allJust final1''+ final3 <- GhcMonad.liftIO $ mapM matchToUrl final2++ GhcMonad.liftIO $ putStrLn "last bits 5..."+ if null final3+ then do yyy''' <- actualFinalCase ghcOpts0 ghcpkgOptions targetFile targetModule symbol haskellModuleNames'+ if null yyy'''+ then return $ Left $ "No matches found."+ else return $ Right yyy'''+ else return $ Right final3 -- | Top level function; use this one from src/Main.hs. haddockUrl :: Options -> FilePath -> String -> String -> Int -> Int -> IO String
README.md view
@@ -76,9 +76,14 @@ ### ghcimportedfrom-vim -Follow the instructions at+For Vim users,+follow the instructions at [https://github.com/carlohamalainen/ghcimportedfrom-vim](https://github.com/carlohamalainen/ghcimportedfrom-vim) to install the Vim plugin.++### ghc-imported-from-el++For Emacs users, David Christiansen has written [ghc-imported-from-el](https://github.com/david-christiansen/ghc-imported-from-el). ## Usage
changelog.md view
@@ -1,3 +1,8 @@+2015-08-17 v0.2.0.7++* Added a fall-back case when our resolved qualified name+ does not match anything.+ 2014-07-05 v0.2.0.6 * Use optparse-applicative for argument parsing.
ghc-imported-from.cabal view
@@ -1,5 +1,5 @@ name: ghc-imported-from-version: 0.2.0.6+version: 0.2.0.7 synopsis: Find the Haddock documentation for a symbol. description: Given a Haskell module and symbol, determine the URL to the Haddock documentation for that symbol.@@ -25,7 +25,7 @@ Language.Haskell.GhcImportedFrom.Types other-extensions: CPP, Rank2Types- build-depends: base >=4.6 && <4.8+ build-depends: base < 4.8 , syb , ghc , ghc-paths@@ -51,7 +51,7 @@ main-is: fake-ghc-for-ghc-imported-from.hs GHC-Options: -Wall hs-source-dirs: src- build-depends: base >=4.6 && <4.8+ build-depends: base < 4.8 , process default-language: Haskell2010 @@ -60,7 +60,7 @@ GHC-Options: -Wall other-modules: Paths_ghc_imported_from other-extensions: CPP, Rank2Types- build-depends: base >=4.6 && <4.8+ build-depends: base < 4.8 , syb , ghc , ghc-paths@@ -94,7 +94,7 @@ Type: exitcode-stdio-1.0 Other-Modules: Dir ImportedFromSpec- Build-Depends: base >=4.6 && <4.8+ Build-Depends: base < 4.8 , syb , ghc , ghc-paths