dash-haskell 1.0.0.4 → 1.0.0.5
raw patch · 9 files changed
+47/−42 lines, 9 filesdep ~basedep ~ghcdep ~optparse-applicativenew-uploader
Dependency ranges changed: base, ghc, optparse-applicative
Files
- README.md +6/−2
- dash-haskell.cabal +4/−4
- src/Haddock/Artifact.hs +2/−2
- src/Haddock/Sqlite.hs +4/−4
- src/Main.hs +1/−1
- src/Package/Conf.hs +1/−1
- src/Pipes/Conf.hs +3/−2
- src/Pipes/Db.hs +15/−15
- src/Pipes/FileSystem.hs +11/−11
README.md view
@@ -1,6 +1,6 @@ dash-haskell ============-**local and approximate package doc access for your Haskell project dependencies**+**local and approximate package docs for your Haskell project dependencies** **direct to browser lookup:** @@ -215,9 +215,13 @@ Contributors ============-Hirotomo Moriwaki <philopon.dependence@gmail.com>+Hirotomo Moriwaki : <philopon.dependence@gmail.com> The major instigator of this project was Hirotomo Moriwaki's [haddocset](https://github.com/philopon/haddocset), with much of the early implementation of *dash-haskell* influenced by that code-base.++Rudi Grinberg : [github](http://github.com/rgrinberg)++For patches, testing, and helping maintain compatibility of ```dash-haskell-1.0.x.x``` with ghc changes Author & Maintainer ===================
dash-haskell.cabal view
@@ -1,5 +1,5 @@ name: dash-haskell-version: 1.0.0.4+version: 1.0.0.5 synopsis: Command line tool to generate Dash docsets (IDE docs) from package haddock homepage: http://www.github.com/jfeltz/dash-haskell Bug-reports: https://github.com/jfeltz/dash-haskell/issues@@ -122,15 +122,15 @@ Package.Conf build-depends: Cabal >= 1.18- , base >= 4.7 && <4.8+ , base >= 4.7 && < 4.9 , bytestring >= 0.10.0.1 , containers >= 0.5.5.1 , direct-sqlite >= 2.3.13 , directory >= 1.2.1.0 , either >= 4.3- , ghc >= 7.8.3 && < 7.10.1+ , ghc >= 7.10.1 , mtl >= 2.1.3.1- , optparse-applicative >= 0.11.0 && <= 0.11.1+ , optparse-applicative >= 0.11.0 && < 0.12.0 , pipes >= 4.1.0 , process >= 1.2.0.0 , sqlite-simple >= 0.4.5.0
src/Haddock/Artifact.hs view
@@ -20,7 +20,7 @@ parseError e p = err $ preposition "parser error" "in" "haddock interface" (P.encodeString p) [e] -fromInterfaces :: Ghc.PackageId -> [InstalledInterface] -> [Artifact] +fromInterfaces :: Ghc.PackageKey -> [InstalledInterface] -> [Artifact] fromInterfaces _ [] = [] fromInterfaces pkg (i:rest) = let moduleName = instMod i in@@ -34,7 +34,7 @@ else fromInterfaces pkg rest -toArtifacts :: Ghc.PackageId -> P.FilePath -> M [Artifact]+toArtifacts :: Ghc.PackageKey -> P.FilePath -> M [Artifact] toArtifacts pkg haddock' = do interface_file <- liftIO $ readInterfaceFile freshNameCache (P.encodeString haddock') case interface_file of
src/Haddock/Sqlite.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE OverloadedStrings, ScopedTypeVariables #-} module Haddock.Sqlite where import Control.Monad.IO.Class import Control.Monad.M@@ -59,10 +59,10 @@ escapeSpecial = concatMap (\c -> if c `elem` specialChars then '-': show (fromEnum c) ++ "-" else [c]) where- specialChars = "!&|+$%(,)*<>-/=#^\\?"+ specialChars :: String = "!&|+$%(,)*<>-/=#^\\?" -- | Update the sqlite database with the given haddock artifact.-fromArtifact :: Ghc.PackageId -> Connection -> Artifact -> M ()+fromArtifact :: Ghc.PackageKey -> Connection -> Artifact -> M () fromArtifact p conn art = do attributes <- toAttributes case attributes of @@ -86,7 +86,7 @@ return Nothing Package -> return . Just $ - (Ghc.packageIdString p, "Package", "index.html", [])+ (Ghc.packageKeyString p, "Package", "index.html", []) Module ghcmod -> return . Just $ (modStr ghcmod, "Module" , modUrl ghcmod ++ ".html" , modStr ghcmod)
src/Main.hs view
@@ -34,6 +34,6 @@ where parserInfo :: ParserInfo Options parserInfo = info (helper <*> parser) $- header "dash-haskell v1.0.0.4, a dash docset construction tool for Haskell packages"+ header "dash-haskell v1.0.0.5, a dash docset construction tool for Haskell packages" <> progDesc "additional help is available with \"dash-haskell help <topic|option>\"" <> footer "http://www.github.com/jfeltz/dash-haskell (C) John P. Feltz 2014"
src/Package/Conf.hs view
@@ -3,7 +3,7 @@ import qualified Filesystem.Path.CurrentOS as P data Conf = Conf- { pkg :: Ghc.PackageId+ { pkg :: Ghc.PackageKey , interfaceFile :: P.FilePath -- interface, i.e. .haddock file , htmlDir :: P.FilePath -- root html source directory , exposed :: Bool -- module exposure flag
src/Pipes/Conf.hs view
@@ -7,6 +7,7 @@ import Data.Maybe import Data.String.Util import Distribution.InstalledPackageInfo as DIP+import Distribution.Text (display) import qualified Filesystem.Path.CurrentOS as P import qualified Module as Ghc import Package.Conf@@ -43,7 +44,7 @@ Conf -- We're not using Cabal's type information beyond just -- extracting package data. Ghc types are used for the rest.- (Ghc.mkPackageId . sourcePackageId $ fields)+ (Ghc.stringToPackageKey . display . sourcePackageId $ fields) -- TODO Respect multiple interfaces, however -- this is not the common consensus for use of haddock interfaces. (P.decodeString (head $ haddockInterfaces fields))@@ -71,6 +72,6 @@ else lift $ do msg "\n"- warning $ "failed to process: " ++ Ghc.packageIdString (pkg c)+ warning $ "failed to process: " ++ Ghc.packageKeyString (pkg c) warning $ preposition "path errors" "in" "pkg conf file" pkg_db_conf errors msg "\n"
src/Pipes/Db.hs view
@@ -22,7 +22,7 @@ -- | If parsed matches a member of the set by version first, return, -- otherwise return unversioned match.-toPkgMatch :: String -> State (S.Set String) (Maybe (String, Ghc.PackageId)) +toPkgMatch :: String -> State (S.Set String) (Maybe (String, Ghc.PackageKey)) toPkgMatch parsed = do unassigned <- get if S.member parsed unassigned -- found versioned @@ -33,18 +33,18 @@ then fromFound parsed' else return Nothing where- fromFound :: String -> State (S.Set String) (Maybe (String, Ghc.PackageId))+ fromFound :: String -> State (S.Set String) (Maybe (String, Ghc.PackageKey)) fromFound p = do modify (S.delete p)- return . Just $ (p, Ghc.stringToPackageId parsed)+ return . Just $ (p, Ghc.stringToPackageKey parsed) -- | A crude parser that extracts db -> package set relations based -- on whitespace indentation accumPaths :: [String] -- output of ghc-pkg or ghc-pkg like listing -> S.Set String -- set of packages not yet associated to a db - -> [(FilePath, [(String, Ghc.PackageId)])]- -> M [(FilePath, [(String, Ghc.PackageId)])]+ -> [(FilePath, [(String, Ghc.PackageKey)])]+ -> M [(FilePath, [(String, Ghc.PackageKey)])] accumPaths [] _ assigned = return assigned accumPaths (l:rest) unassigned assigned = @@ -87,9 +87,9 @@ isPath :: String -> Bool isPath [] = False- isPath s = head s `L.notElem` "\n\r\t "+ isPath s = head s `L.notElem` ("\n\r\t " :: String) -toMapping :: String -> [String] -> S.Set String -> M [(FilePath, [(String, Ghc.PackageId)])]+toMapping :: String -> [String] -> S.Set String -> M [(FilePath, [(String, Ghc.PackageKey)])] toMapping cmd args pkgs = do res <- liftIO $ readProcessWithExitCode cmd args [] case res of @@ -101,7 +101,7 @@ accumPaths (L.lines out) pkgs [] -- | This returns a non-empty list of package db's, or failure.-fromProvider :: DbProvider -> S.Set String -> M [(FilePath, [(String, Ghc.PackageId)])]+fromProvider :: DbProvider -> S.Set String -> M [(FilePath, [(String, Ghc.PackageKey)])] fromProvider prov pkgs = do case prov of (Ghc _) -> toMapping cmd extra_args pkgs @@ -110,10 +110,10 @@ where (cmd , extra_args) = toExec prov -isConf :: Ghc.PackageId -> P.FilePath -> Bool +isConf :: Ghc.PackageKey -> P.FilePath -> Bool isConf p f = P.hasExtension f "conf" && pkgRelated p f -findConf :: Ghc.PackageId -> State (S.Set P.FilePath) (Either Ghc.PackageId P.FilePath)+findConf :: Ghc.PackageKey -> State (S.Set P.FilePath) (Either Ghc.PackageKey P.FilePath) findConf package = do files <- get let matching = S.filter (isConf package) files@@ -126,7 +126,7 @@ -- | Return a list of package configurations for the given -- db and handled packages-fromPair :: FilePath -> [Ghc.PackageId] -> M [FilePath]+fromPair :: FilePath -> [Ghc.PackageKey] -> M [FilePath] fromPair _ [] = return [] fromPair db members = do @@ -134,12 +134,12 @@ let (remainder, confs') = partitionEithers $ evalState (mapM findConf members) confs unless (L.null remainder) . warning $ "The following packages were not found in the pkg db dir: \n" ++ - L.intercalate "\n" (map Ghc.packageIdString remainder)+ L.intercalate "\n" (map Ghc.packageKeyString remainder) mapM (return . P.encodeString) confs' -pkgRelated :: Ghc.PackageId -> P.FilePath -> Bool+pkgRelated :: Ghc.PackageKey -> P.FilePath -> Bool pkgRelated p = - T.isPrefixOf (T.pack . Ghc.packageIdString $ p) + T.isPrefixOf (T.pack . Ghc.packageKeyString $ p) . T.pack . P.encodeString . P.filename@@ -169,7 +169,7 @@ else -- yield over each returned file, -- types are added to make this _much_ easier to understand let - mapped :: (FilePath, [(String, Ghc.PackageId)]) -> M [FilePath]+ mapped :: (FilePath, [(String, Ghc.PackageKey)]) -> M [FilePath] mapped = uncurry fromPair . (\(db, members) -> (db, map snd members)) in mapM_ yield =<< lift (L.concat <$> mapM mapped pairings)
src/Pipes/FileSystem.hs view
@@ -25,16 +25,16 @@ -- TODO the utility of some of these fields is still unclear to me, -- at the moment they are filled simply to satisfy the docset spec.-plist :: Ghc.PackageId -> BS.ByteString+plist :: Ghc.PackageKey -> BS.ByteString plist p = Data.ByteString.Char8.pack . unlines $ [ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" , "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">" , "<plist version=\"1.0\">" , "<dict>" , "<key>CFBundleIdentifier</key>"- , "<string>" ++ Ghc.packageIdString p ++ "</string>"+ , "<string>" ++ Ghc.packageKeyString p ++ "</string>" , "<key>CFBundleName</key>"- , "<string>docset for Haskell package " ++ Ghc.packageIdString p ++ "</string>"+ , "<string>docset for Haskell package " ++ Ghc.packageKeyString p ++ "</string>" , "<key>DocSetPlatformFamily</key>" , "<string>haskell</string>" , "<key>isDashDocset</key>"@@ -45,8 +45,8 @@ , "</plist>" ] -docsetDir :: Ghc.PackageId -> P.FilePath-docsetDir p = P.decodeString $ Ghc.packageIdString p ++ ".docset" +docsetDir :: Ghc.PackageKey -> P.FilePath+docsetDir p = P.decodeString $ Ghc.packageKeyString p ++ ".docset" leafs :: (P.FilePath -> Bool) -> P.FilePath -> ProducerM P.FilePath () leafs incPred p = do@@ -89,10 +89,10 @@ . length . P.splitDirectories <$> toStripped pfx base -relativize :: Ghc.PackageId -> P.FilePath -> Either String T.Text +relativize :: Ghc.PackageKey -> P.FilePath -> Either String T.Text relativize package p = let filename = P.filename p- packageSubpath = P.decodeString $ Ghc.packageIdString package+ packageSubpath = P.decodeString $ Ghc.packageKeyString package matches = filter (packageSubpath ==) . reverse $ P.splitDirectories (P.parent p) in T.pack . P.encodeString <$> @@ -101,7 +101,7 @@ else -- assume as a package doc file and make relative toRelativePath packageSubpath $ L.head matches </> filename -convertUrl :: Ghc.PackageId -> T.Text -> Either String T.Text +convertUrl :: Ghc.PackageKey -> T.Text -> Either String T.Text convertUrl p urlExp | T.null urlExp = Right T.empty | otherwise = @@ -121,7 +121,7 @@ ++ show other ++ "\n in: \n" ++ P.encodeString src -- | Convert local package-compiled haddock links to local relative. -convertLink :: Ghc.PackageId -> P.FilePath -> Tag' -> Either String Tag'+convertLink :: Ghc.PackageKey -> P.FilePath -> Tag' -> Either String Tag' convertLink package src tag = -- We're only interested in processing links if not $ tagOpenLit "a" (anyAttrNameLit "href") tag then @@ -137,7 +137,7 @@ url' <- convertUrl package url Right . TagOpen "a" $ ("href", url') : preserved -pipe_htmlConvert :: Ghc.PackageId -> PipeM P.FilePath (P.FilePath, Maybe BS.ByteString) ()+pipe_htmlConvert :: Ghc.PackageKey -> PipeM P.FilePath (P.FilePath, Maybe BS.ByteString) () pipe_htmlConvert p = forever $ do src <- await@@ -182,7 +182,7 @@ cons_writeFiles docsets_root = forever $ do conf <- await - lift . msg $ "processing: " ++ (Ghc.packageIdString . pkg $ conf)+ lift . msg $ "processing: " ++ (Ghc.packageKeyString . pkg $ conf) let docset_folder = docsetDir (pkg conf) dst_root = docsets_root </> docset_folder dst_doc_root = dst_root </> P.decodeString "Contents/Resources/Documents/"