hdocs 0.4.2.1 → 0.4.3.0
raw patch · 2 files changed
+13/−6 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ HDocs.Haddock: readSources :: [String] -> [FilePath] -> ExceptT String IO (Map String ModuleDocMap)
+ HDocs.Haddock: readSources_ :: [String] -> [FilePath] -> ExceptT String IO [(String, ModuleDocMap)]
Files
- hdocs.cabal +1/−1
- src/HDocs/Haddock.hs +12/−5
hdocs.cabal view
@@ -1,5 +1,5 @@ name: hdocs -version: 0.4.2.1 +version: 0.4.3.0 synopsis: Haskell docs tool description: Tool and library to get docs for installed packages and source files.
src/HDocs/Haddock.hs view
@@ -2,7 +2,7 @@ -- * Documentation functions readInstalledDocs, readHaddock, - readSource, + readSources, readSources_, readSource, -- * Extract docs installedInterfaceDocs, installedInterfacesDocs, @@ -44,12 +44,19 @@ readHaddock :: FilePath -> ExceptT String IO (Map String ModuleDocMap) readHaddock f = M.fromList . map installedInterfaceDocs <$> readInstalledInterfaces f +-- | Read docs for haskell modules +readSources :: [String] -> [FilePath] -> ExceptT String IO (Map String ModuleDocMap) +readSources opts = liftM M.fromList . readSources_ opts + +-- | Read docs for haskell modules +readSources_ :: [String] -> [FilePath] -> ExceptT String IO [(String, ModuleDocMap)] +readSources_ opts fs = do + ifaces <- liftError $ liftIO $ createInterfaces ([Flag_Verbosity "0", Flag_NoWarnings] ++ map Flag_OptGhc opts) fs + return $ map interfaceDocs ifaces + -- | Read docs for haskell module readSource :: [String] -> FilePath -> ExceptT String IO (String, ModuleDocMap) -readSource opts f = do - ifaces <- liftError $ liftIO $ createInterfaces ([Flag_Verbosity "0", Flag_NoWarnings] ++ map Flag_OptGhc opts) [f] - iface <- maybe (throwError $ "Failed to load docs for " ++ f) return $ listToMaybe ifaces - return $ interfaceDocs iface +readSource opts f = liftM listToMaybe (readSources_ opts [f]) >>= maybe (throwError $ "Failed to load docs for " ++ f) return -- | Get docs for 'InstalledInterface' installedInterfaceDocs :: InstalledInterface -> (String, ModuleDocMap)