diff -ru orig/datadir/resources/search.xml new/datadir/resources/search.xml --- orig/datadir/resources/search.xml 2013-12-04 19:36:25.391122832 +0200 +++ new/datadir/resources/search.xml 2013-12-04 19:36:25.000000000 +0200 @@ -11,8 +11,8 @@ - http://haskell.org/hoogle/datadir/resources/favicon.png - http://haskell.org/hoogle/datadir/resources/favicon64.png + http://haskell.org/hoogle/res/favicon.png + http://haskell.org/hoogle/res/favicon64.png Neil Mitchell false en-us diff -ru orig/hoogle.cabal new/hoogle.cabal --- orig/hoogle.cabal 2013-12-04 19:36:25.395122833 +0200 +++ new/hoogle.cabal 2013-12-04 19:36:25.000000000 +0200 @@ -15,7 +15,7 @@ or by approximate type signature. homepage: http://www.haskell.org/hoogle/ bug-reports: https://github.com/ndmitchell/hoogle/issues -stability: Beta +tested-with: GHC==7.6.3, GHC==7.4.2, GHC==7.2.2 extra-source-files: README.txt datadir/*.txt @@ -72,8 +72,8 @@ Hoogle.Language.Haskell other-modules: - Data.Heap - Data.TypeMap + General.Heap + General.TypeMap General.Base General.System General.Util @@ -172,17 +172,9 @@ Web.Template test-suite hoogle-test - main-is: HoogleSpec.hs - hs-source-dirs: test + main-is: Test.hs + hs-source-dirs: src default-language: Haskell98 type: exitcode-stdio-1.0 - build-depends: - base >=3, - hoogle, - conduit >= 0.2, - system-fileio >= 0.3.11, - transformers >= 0.2, - HUnit >= 1.2.5, - hspec >= 1.4.4, - hspec-expectations >= 0.3 + build-depends: base >= 3, process, directory, filepath diff -ru orig/src/Console/All.hs new/src/Console/All.hs --- orig/src/Console/All.hs 2013-12-04 19:36:25.387122831 +0200 +++ new/src/Console/All.hs 2013-12-04 19:36:25.000000000 +0200 @@ -29,10 +29,9 @@ action (Test files _) = do testPrepare fails <- fmap sum $ mapM (testFile action) files - putStrLn $ - if fails == 0 - then "Tests passed" - else "TEST FAILURES (" ++ show fails ++ ")" + if fails == 0 then putStrLn "Tests passed" else do + putStrLn $ "TEST FAILURES (" ++ show fails ++ ")" + exitFailure action (Rank file) = rank file diff -ru orig/src/Console/Test.hs new/src/Console/Test.hs --- orig/src/Console/Test.hs 2013-12-04 19:36:25.387122831 +0200 +++ new/src/Console/Test.hs 2013-12-04 19:36:25.000000000 +0200 @@ -22,6 +22,7 @@ putStrLn "Converting testdata" performGC -- clean up the databases dat <- getDataDir + createDirectoryIfMissing True $ dat "databases" src <- readFileUtf8 $ dat "testdata.txt" let (errs, dbOld) = createDatabase Haskell [] src unless (null errs) $ error $ unlines $ "Couldn't convert testdata database:" : map show errs Only in orig/src: Data Only in new/src/General: Heap.hs Only in new/src/General: TypeMap.hs diff -ru orig/src/General/Web.hs new/src/General/Web.hs --- orig/src/General/Web.hs 2013-12-04 19:36:25.387122831 +0200 +++ new/src/General/Web.hs 2013-12-04 19:36:25.000000000 +0200 @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE PatternGuards #-} {- | @@ -15,6 +16,9 @@ import General.System import General.Base import Network.Wai +#if MIN_VERSION_wai(2, 0, 0) +import Network.Wai.Internal +#endif import Network.HTTP.Types import Data.CaseInsensitive(original) import qualified Data.ByteString.Lazy.Char8 as LBS @@ -34,10 +38,17 @@ responseFlatten :: Response -> IO (Status, ResponseHeaders, LBString) responseFlatten r = do +#if MIN_VERSION_wai(2, 0, 0) + let (s,hs,withSrc) = responseToSource r + chunks <- withSrc $ \src -> src $$ consume + let res = toLazyByteString $ mconcat [x | Chunk x <- chunks] + return (s,hs,res) +#else let (s,hs,rest) = responseSource r chunks <- runResourceT $ rest $$ consume let res = toLazyByteString $ mconcat [x | Chunk x <- chunks] return (s,hs,res) +#endif responseEvaluate :: Response -> IO () diff -ru orig/src/Hoogle/DataBase/TypeSearch/Graphs.hs new/src/Hoogle/DataBase/TypeSearch/Graphs.hs --- orig/src/Hoogle/DataBase/TypeSearch/Graphs.hs 2013-12-04 19:36:25.387122831 +0200 +++ new/src/Hoogle/DataBase/TypeSearch/Graphs.hs 2013-12-04 19:36:25.000000000 +0200 @@ -11,7 +11,7 @@ import Hoogle.Store.All import qualified Data.IntMap as IntMap -import qualified Data.Heap as Heap +import qualified General.Heap as Heap import General.Base import General.Util import Control.Monad.Trans.State diff -ru orig/src/Recipe/Download.hs new/src/Recipe/Download.hs --- orig/src/Recipe/Download.hs 2013-12-04 19:36:25.383122832 +0200 +++ new/src/Recipe/Download.hs 2013-12-04 19:36:25.000000000 +0200 @@ -47,8 +47,8 @@ , (inputs <.> "txt", inputs <.> "tar.gz", "http://old.hackage.haskell.org/packages/archive/00-hoogle.tar.gz") ] withDownloader opt downloader items - extractTarball cabals - extractTarball inputs + doesFileExist (cabals <.> "tar.gz") >>= \b -> when b $ extractTarball cabals + doesFileExist (inputs <.> "tar.gz") >>= \b -> when b $ extractTarball inputs check :: String -> IO (Maybe FilePath) diff -ru orig/src/Recipe/Keyword.hs new/src/Recipe/Keyword.hs --- orig/src/Recipe/Keyword.hs 2013-12-04 19:36:25.383122832 +0200 +++ new/src/Recipe/Keyword.hs 2013-12-04 19:36:25.000000000 +0200 @@ -13,10 +13,9 @@ translate :: String -> String translate src = unlines $ keywordPrefix ++ items - where items = concatMap keywordFormat $ drop 1 $ partitions (~== "") $ + where items = concatMap keywordFormat $ partitions (~== "") $ takeWhile (~/= "
") $ parseTags src - keywordPrefix = ["-- Hoogle documentation, generated by Hoogle" ,"-- From http://www.haskell.org/haskellwiki/Keywords" @@ -33,17 +32,16 @@ noUnderscore "_" = "_" noUnderscore xs = map (\x -> if x == '_' then ' ' else x) xs - name = words $ f $ fromAttrib "name" (head x) + name = words $ f $ fromAttrib "id" (head x) docs = zipWith (++) ("-- | " : repeat "-- ") $ intercalate [""] $ - map (docFormat . takeWhile (~/= "
")) $ + map docFormat $ partitions isBlock x g x | isAlpha x || x `elem` "_-:" = [x] | otherwise = '.' : map toUpper (showHex (ord x) "") - - isBlock (TagOpen x _) = x `elem` ["p","pre"] + isBlock (TagOpen x _) = x `elem` ["p","pre","ul"] isBlock _ = False f ('.':'2':'C':'_':xs) = ' ' : f xs @@ -56,7 +54,7 @@ docFormat :: [Tag String] -> [String] docFormat (TagOpen "pre" _:xs) = ["
"] ++ map (drop n) ys ++ ["
"] where - ys = lines $ innerText xs + ys = lines $ reverse $ dropWhile isSpace $ reverse $ innerText xs n = minimum $ map (length . takeWhile isSpace) ys docFormat (TagOpen "p" _:xs) = g 0 [] $ words $ f xs @@ -73,3 +71,6 @@ h (TagText x) = unwords (lines x) h _ = "" + +docFormat (TagOpen "ul" _:xs) = + ["
  • "] ++ intercalate ["
  • "] [docFormat (TagOpen "p" []:x) | x <- partitions (~== "
  • ") xs] ++ ["
"] Only in new/src: Test.hs diff -ru orig/src/Web/Server.hs new/src/Web/Server.hs --- orig/src/Web/Server.hs 2013-12-04 19:36:25.379122832 +0200 +++ new/src/Web/Server.hs 2013-12-04 19:36:25.000000000 +0200 @@ -1,4 +1,4 @@ -{-# LANGUAGE RecordWildCards, ScopedTypeVariables, PatternGuards #-} +{-# LANGUAGE RecordWildCards, ScopedTypeVariables, PatternGuards, CPP #-} module Web.Server(server) where @@ -16,6 +16,9 @@ import Data.Time.Clock import Network.Wai +#if MIN_VERSION_wai(2, 0, 0) +import Network.Wai.Internal +#endif import Network.Wai.Handler.Warp @@ -34,9 +37,15 @@ return res +#if MIN_VERSION_wai(2, 0, 0) +exception :: Maybe Request -> SomeException -> IO () +exception _ e | Just (_ :: InvalidRequest) <- fromException e = return () + | otherwise = putStrLn $ "Error: " ++ show e +#else exception :: SomeException -> IO () exception e | Just (_ :: InvalidRequest) <- fromException e = return () | otherwise = putStrLn $ "Error: " ++ show e +#endif respArgs :: CmdLine -> IO (IO ResponseArgs) Only in orig: test