packages feed

hoogle 5.0.6 → 5.0.7

raw patch · 4 files changed

+15/−12 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

CHANGES.txt view
@@ -1,5 +1,7 @@ Changelog for Hoogle +5.0.7+    #200, make sure the content-type is set properly 5.0.6     #196, make --local look for .cabal files as well     Fix up Frege documentation generation
hoogle.cabal view
@@ -1,7 +1,7 @@ cabal-version:      >= 1.18 build-type:         Simple name:               hoogle-version:            5.0.6+version:            5.0.7 license:            BSD3 license-file:       LICENSE category:           Development@@ -38,8 +38,9 @@     location: https://github.com/ndmitchell/hoogle.git  flag network-uri-    description: Get Network.URI from the network-uri package     default: True+    manual: False+    description: Get Network.URI from the network-uri package  library     hs-source-dirs:     src
src/Action/Server.hs view
@@ -85,14 +85,14 @@         let (q2, results) = search store q         let body = showResults local inputArgs q2 $ dedupeTake 25 (\t -> t{targetURL="",targetPackage=Nothing, targetModule=Nothing}) results         case lookup "mode" $ reverse inputArgs of-            Nothing | qSource /= [] -> fmap OutputString $ templateRender templateIndex $ map (second str)+            Nothing | qSource /= [] -> fmap OutputHTML $ templateRender templateIndex $ map (second str)                         [("tags",tagOptions qScope)                         ,("body",body)                         ,("title",unwords qSource ++ " - Hoogle")                         ,("search",unwords $ grab "hoogle")                         ,("robots",if any isQueryScope q then "none" else "index")]-                    | otherwise -> OutputString <$> templateRender templateHome []-            Just "body" -> OutputString <$> if null qSource then templateRender templateEmpty [] else return $ lstrPack body+                    | otherwise -> OutputHTML <$> templateRender templateHome []+            Just "body" -> OutputHTML <$> if null qSource then templateRender templateEmpty [] else return $ lstrPack body             Just "json" -> return $ OutputJSON $ JSON.encode $ take 100 results             Just m -> return $ OutputFail $ lstrPack $ "Mode " ++ m ++ " not (currently) supported"     ["plugin","jquery.js"] -> OutputFile <$> JQuery.file@@ -104,7 +104,7 @@         let errs = sum [summaryErrors | Summary{..} <- summ, summaryDate >= pred (utctDay now)]         let alive = fromRational $ toRational $ (now `diffUTCTime` spawned) / (24 * 60 * 60)         let s = show errs ++ " errors since yesterday, running for " ++ showDP 2 alive ++ " days."-        return $ if errs == 0 && alive < 1.5 then OutputString $ lstrPack $ "Happy. " ++ s else OutputFail $ lstrPack $ "Sad. " ++ s+        return $ if errs == 0 && alive < 1.5 then OutputText $ lstrPack $ "Happy. " ++ s else OutputFail $ lstrPack $ "Sad. " ++ s     ["log"] -> do         log <- displayLog <$> logSummary log         OutputHTML <$> templateRender templateLog [("data",str log)]@@ -112,7 +112,7 @@         stats <- getGCStatsEnabled         if stats then do             x <- getGCStats-            return $ OutputString $ lstrPack $ replace ", " "\n" $ takeWhile (/= '}') $ drop 1 $ dropWhile (/= '{') $ show x+            return $ OutputText $ lstrPack $ replace ", " "\n" $ takeWhile (/= '}') $ drop 1 $ dropWhile (/= '{') $ show x          else             return $ OutputFail $ lstrPack "GHC Statistics is not enabled, restart with +RTS -T"     "file":xs | local -> do@@ -233,7 +233,7 @@         log <- logNone         dataDir <- getDataDir         let q === want = do-                OutputString (lstrUnpack -> res) <- replyServer log False store "" "" (dataDir </> "html") "" (Input [] [("hoogle",q)])+                OutputHTML (lstrUnpack -> res) <- replyServer log False store "" "" (dataDir </> "html") "" (Input [] [("hoogle",q)])                 if want `isInfixOf` res then putChar '.' else fail $ "Bad substring: " ++ res         if sample then             "Wife" === "<b>type family</b>"
src/General/Web.hs view
@@ -43,7 +43,7 @@     map (second (unEscapeString . drop1) . breakOn "=") $ splitOn "&" $ drop1 b  data Output-    = OutputString LBS.ByteString+    = OutputText LBS.ByteString     | OutputHTML LBS.ByteString     | OutputJSON LBS.ByteString     | OutputFail LBS.ByteString@@ -51,7 +51,7 @@       deriving Show  instance NFData Output where-    rnf (OutputString x) = rnf x+    rnf (OutputText x) = rnf x     rnf (OutputJSON x) = rnf x     rnf (OutputHTML x) = rnf x     rnf (OutputFail x) = rnf x@@ -95,8 +95,8 @@             Right v -> reply $ case v of                 OutputFile file -> responseFile status200                     [("content-type",c) | Just c <- [lookup (takeExtension file) contentType]] file Nothing-                OutputString msg -> responseLBS status200 [] msg-                OutputJSON msg -> responseLBS status200 [("content-type", "application/json"), ("access-control-allow-origin", "*")] msg+                OutputText msg -> responseLBS status200 [("content-type","text/plain")] msg+                OutputJSON msg -> responseLBS status200 [("content-type","application/json"), ("access-control-allow-origin","*")] msg                 OutputFail msg -> responseLBS status500 [] msg                 OutputHTML msg -> responseLBS status200 [("content-type","text/html")] msg