haskell-docs 0.1.0.0 → 0.1.1.0
raw patch · 2 files changed
+11/−8 lines, 2 files
Files
- haskell-docs.cabal +2/−2
- src/Main.hs +9/−6
haskell-docs.cabal view
@@ -1,5 +1,5 @@ name: haskell-docs-version: 0.1.0.0+version: 0.1.1.0 synopsis: A program to find and display the docs of a name from a given module. description: Given a module name and a name, it will find and display@@ -25,7 +25,7 @@ so too will this program be, to GHC, and to Haddock. I suggest installing like this: .- > cabal-dev install haskell-docs --constraint haddock==2.10.0+ > cabal install haskell-docs --constraint haddock==2.10.0 . But replace the 2.10.0 with the version that haddock --version gives you. .
src/Main.hs view
@@ -102,16 +102,19 @@ flip anyM files $ \interfaceFile -> case filter ((==mname) . moduleName . instMod) (ifInstalledIfaces interfaceFile) of [] -> error "Couldn't find an interface for that module in the package description."- interfaces -> anyM (printWithInterface d printPackage package name) interfaces+ interfaces -> anyM (printWithInterface d printPackage package name mname) interfaces -- | Print the documentation from the given interface.-printWithInterface :: DynFlags -> Bool -> PackageConfig -> String -> InstalledInterface -> IO Bool-printWithInterface d printPackage package name interface = do+printWithInterface :: DynFlags -> Bool -> PackageConfig -> String -> ModuleName -> InstalledInterface+ -> IO Bool+printWithInterface d printPackage package name mname interface = do case M.lookup name docMap of- Nothing ->+ Nothing -> do case lookup name (map (getOccString &&& id) (instExports interface)) of- Just subname -> descendSearch d name subname package- Nothing -> do+ Just subname+ | moduleName (nameModule subname) /= moduleName (instMod interface) ->+ descendSearch d name subname package+ _ -> do putStrLn $ "Couldn't find name ``" ++ name ++ "'' in Haddock interface: " ++ moduleNameString (moduleName (instMod interface)) return False