hoogle 5.0.17.4 → 5.0.17.5
raw patch · 10 files changed
+35/−38 lines, 10 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Hoogle: Target :: URL -> Maybe (PkgName, URL) -> Maybe (ModName, URL) -> String -> String -> String -> Target
+ Hoogle: Target :: URL -> Maybe (String, URL) -> Maybe (String, URL) -> String -> String -> String -> Target
- Hoogle: [targetModule] :: Target -> Maybe (ModName, URL)
+ Hoogle: [targetModule] :: Target -> Maybe (String, URL)
- Hoogle: [targetPackage] :: Target -> Maybe (PkgName, URL)
+ Hoogle: [targetPackage] :: Target -> Maybe (String, URL)
Files
- CHANGES.txt +5/−1
- LICENSE +1/−1
- hoogle.cabal +3/−3
- html/index.html +1/−1
- html/welcome.html +0/−3
- src/Action/Search.hs +13/−16
- src/Action/Server.hs +2/−2
- src/Input/Haddock.hs +2/−2
- src/Input/Item.hs +5/−5
- src/Output/Items.hs +3/−4
CHANGES.txt view
@@ -1,6 +1,10 @@-Changelog for Hoogle+Changelog for Hoogle (* = breaking change) +5.0.17.5, released 2019-01-27+* #285, remove accidental API break in 5.0.17.4+ Lots of improvements in type search 5.0.17.4, released 2018-12-10+* #285, change targetPackage/Module to be opaque Require haskell-src-exts-1.21 #271, added FromJSON instance for Target #253, adds JSON pagination from query parameters
LICENSE view
@@ -1,4 +1,4 @@-Copyright Neil Mitchell 2004-2018.+Copyright Neil Mitchell 2004-2019. All rights reserved. Redistribution and use in source and binary forms, with or without
hoogle.cabal view
@@ -1,13 +1,13 @@ cabal-version: >= 1.18 build-type: Simple name: hoogle-version: 5.0.17.4+version: 5.0.17.5 license: BSD3 license-file: LICENSE category: Development author: Neil Mitchell <ndmitchell@gmail.com> maintainer: Neil Mitchell <ndmitchell@gmail.com>-copyright: Neil Mitchell 2004-2018+copyright: Neil Mitchell 2004-2019 synopsis: Haskell API Search description: Hoogle is a Haskell API search engine, which allows you to@@ -15,7 +15,7 @@ or by approximate type signature. homepage: http://hoogle.haskell.org/ bug-reports: https://github.com/ndmitchell/hoogle/issues-tested-with: GHC==8.6.1, GHC==8.4.4, GHC==8.2.2, GHC==8.0.2+tested-with: GHC==8.6.3, GHC==8.4.4, GHC==8.2.2, GHC==8.0.2 extra-doc-files: README.md CHANGES.txt
html/index.html view
@@ -33,6 +33,6 @@ <div id="body"> #{body} </div>- <div id="footer">© <a href="http://ndmitchell.com">Neil Mitchell</a> 2004-2018, version #{version}</div>+ <div id="footer">© <a href="http://ndmitchell.com">Neil Mitchell</a> 2004-2019, version #{version}</div> </body> </html>
html/welcome.html view
@@ -6,9 +6,6 @@ <li><a href="https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/">GHC Manual</a></li> <li><a href="https://downloads.haskell.org/~ghc/latest/docs/html/libraries/">Libraries</a></li> </ul>-<p style="border:2px solid red; font-weight: bold; background-color: yellow; padding: 10px; text-align: center;">- Warning: <a href="http://neilmitchell.blogspot.co.uk/2015/01/hoogle-5-is-coming.html">Alpha version, type search doesn't work</a>!-</p> <p> Hoogle is a Haskell API search engine, which allows you to search the Haskell libraries on Stackage by either function name, or by approximate type signature.
src/Action/Search.hs view
@@ -18,7 +18,6 @@ import Action.CmdLine import General.Store-import General.Str import General.Util import Input.Item import Output.Items@@ -60,13 +59,13 @@ unlines $ [ unHTML targetItem ] ++ [ unwords packageModule | not $ null packageModule] ++ [ unHTML targetDocs ]- where packageModule = map (strUnpack . fst) $ catMaybes [targetPackage, targetModule]+ where packageModule = map fst $ catMaybes [targetPackage, targetModule] -- | Returns the Target formatted as an item to display in the results -- | Bool argument decides whether links are shown targetResultDisplay :: Bool -> Target -> String targetResultDisplay link Target{..} = unHTML $ unwords $- fmap (strUnpack . fst) (maybeToList targetModule) +++ map fst (maybeToList targetModule) ++ [targetItem] ++ ["-- " ++ targetURL | link] @@ -186,10 +185,8 @@ , InTop 100 ("return" `inPackage` "base") , KnownFailure "GitHub issue #267" $ ("pure" `inPackage` "base") `AppearsBefore` ("shrinkNothing" `inModule` "Test.QuickCheck")- , KnownFailure "GitHub issue #267" $- InTop 10 ("pure" `inPackage` "base")- , KnownFailure "GitHub issue #267" $- InTop 10 ("return" `inPackage` "base")+ , InTop 10 ("pure" `inPackage` "base")+ , InTop 10 ("return" `inPackage` "base") ] query "[a] -> a" [ InTop 10 ("head" `inPackage` "base")@@ -217,11 +214,15 @@ InTop 10 ("forM" `inPackage` "base") ] query "a -> [(a,b)] -> b"- [ TopHit ("lookup" `inPackage` "base")+ [ KnownFailure "GitHub issue #267" $+ TopHit ("lookup" `inPackage` "base")+ , InTop 3 ("lookup" `inPackage` "base") , DoesNotFind ("zip" `inPackage` "base") ] query "[(a,b)] -> a -> b"- [ TopHit ("lookup" `inPackage` "base")+ [ KnownFailure "GitHub issue #267" $+ TopHit ("lookup" `inPackage` "base")+ , InTop 3 ("lookup" `inPackage` "base") , DoesNotFind ("zip" `inPackage` "base") ] query "(a -> m b) -> t a -> m (t b)" -- see GitHub issue #218@@ -257,8 +258,7 @@ query "a -> m a" -- see GitHub issue #180 [ InTop 20 ("pure" `inPackage` "base") , InTop 50 ("return" `inPackage` "base")- , KnownFailure "GitHub issue #267" $- InTop 3 ("pure" `inPackage` "base")+ , InTop 3 ("pure" `inPackage` "base") , KnownFailure "GitHub issue #267" $ InTop 3 ("return" `inPackage` "base") ]@@ -344,10 +344,10 @@ runTargetMatcher :: TargetMatcher -> Target -> Bool runTargetMatcher matcher Target{..} = case matcher of MatchFunctionInModule f m ->- Just m == fmap (strUnpack . fst) targetModule+ Just m == fmap fst targetModule && f `isPrefixOf` unHTML targetItem MatchFunctionInPackage f m ->- Just m == fmap (strUnpack . fst) targetPackage+ Just m == fmap fst targetPackage && f `isPrefixOf` unHTML targetItem inModule :: String -> String -> TargetMatcher@@ -366,6 +366,3 @@ simple :: Target -> Target simple t = t { targetURL = "", targetPackage = Nothing, targetModule = Nothing }---
src/Action/Server.hs view
@@ -200,12 +200,12 @@ [("is","exact")] ++ [("is","package") | any ((==) "package" . targetType) xs] ++ [("is","module") | any ((==) "module" . targetType) xs] ++- nubOrd [("package",strUnpack p) | Just (p,_) <- map targetPackage xs]+ nubOrd [("package",p) | Just (p,_) <- map targetPackage xs] showFroms :: Bool -> Maybe FilePath -> [Target] -> String showFroms local haddock xs = intercalate ", " $ flip map pkgs $ \p -> let ms = filter ((==) p . targetPackage) xs- in unwords ["<a href=\"" ++ showURL local haddock b ++ "\">" ++ strUnpack a ++ "</a>" | (a,b) <- catMaybes $ p : map remod ms]+ in unwords ["<a href=\"" ++ showURL local haddock b ++ "\">" ++ a ++ "</a>" | (a,b) <- catMaybes $ p : map remod ms] where remod Target{..} = do (a,_) <- targetModule; return (a,targetURL) pkgs = nubOrd $ map targetPackage xs
src/Input/Haddock.hs view
@@ -63,9 +63,9 @@ hierarchyC :: Monad m => URL -> ConduitM (Target, Entry) (Maybe Target, [Item]) m () hierarchyC packageUrl = void $ mapAccumC f (Nothing, Nothing) where- f (pkg, mod) (t, EPackage x) = ((Just (x, url), Nothing), (Just t{targetURL=url}, [IPackage x]))+ f (pkg, mod) (t, EPackage x) = ((Just (strUnpack x, url), Nothing), (Just t{targetURL=url}, [IPackage x])) where url = targetURL t `orIfNull` packageUrl- f (pkg, mod) (t, EModule x) = ((pkg, Just (x, url)), (Just t{targetPackage=pkg, targetURL=url}, [IModule x]))+ f (pkg, mod) (t, EModule x) = ((pkg, Just (strUnpack x, url)), (Just t{targetPackage=pkg, targetURL=url}, [IModule x])) where url = targetURL t `orIfNull` (if isGhc then ghcModuleURL x else hackageModuleURL x) f (pkg, mod) (t, EDecl i@InstDecl{}) = ((pkg, mod), (Nothing, hseToItem_ i)) f (pkg, mod) (t, EDecl x) = ((pkg, mod), (Just t{targetPackage=pkg, targetModule=mod, targetURL=url}, hseToItem_ x))
src/Input/Item.hs view
@@ -109,8 +109,8 @@ -- | A location of documentation. data Target = Target {targetURL :: URL -- ^ URL where this thing is located- ,targetPackage :: Maybe (PkgName, URL) -- ^ Name and URL of the package it is in (Nothing if it is a package)- ,targetModule :: Maybe (ModName, URL) -- ^ Name and URL of the module it is in (Nothing if it is a package or module)+ ,targetPackage :: Maybe (String, URL) -- ^ Name and URL of the package it is in (Nothing if it is a package)+ ,targetModule :: Maybe (String, URL) -- ^ Name and URL of the module it is in (Nothing if it is a package or module) ,targetType :: String -- ^ One of package, module or empty string ,targetItem :: String -- ^ HTML span of the item, using @\<s0\>@ for the name and @\<s1\>@ onwards for arguments ,targetDocs :: String -- ^ HTML documentation to show, a sequence of block level elements@@ -130,7 +130,7 @@ ] where maybeNamedURL m = maybe emptyObject namedURL m- namedURL (name, url) = object [("name" :: T.Text, toJSON $ strUnpack name), ("url" :: T.Text, toJSON url)]+ namedURL (name, url) = object [("name" :: T.Text, toJSON name), ("url" :: T.Text, toJSON url)] instance FromJSON Target where parseJSON = withObject "Target" $ \o ->@@ -146,7 +146,7 @@ else do pkName <- mObj .: ("name" :: T.Text) pkUrl <- mObj .: ("url" :: T.Text)- return $ Just (strPack pkName ,pkUrl)+ return $ Just (pkName, pkUrl) instance Arbitrary Target where arbitrary = Target <$> a@@ -158,7 +158,7 @@ where a = arbitrary mNurl = do oneof [return Nothing- , Just <$> liftA2 (,) (strPack <$> a) a]+ , Just <$> liftA2 (,) a a] targetExpandURL :: Target -> Target targetExpandURL t@Target{..} = t{targetURL = url, targetModule = second (const mod) <$> targetModule}
src/Output/Items.hs view
@@ -4,7 +4,6 @@ import Control.Monad import Data.List.Extra-import Data.Tuple.Extra import qualified Data.ByteString as BS import qualified Data.ByteString.Lazy.Char8 as LBS import qualified Data.ByteString.Lazy.UTF8 as UTF8@@ -23,8 +22,8 @@ outputItem :: Target -> [String] outputItem Target{..} = [if null targetURL then "." else targetURL- ,maybe "." (joinPair " " . first strUnpack) targetPackage- ,maybe "." (joinPair " " . first strUnpack) targetModule+ ,maybe "." (joinPair " ") targetPackage+ ,maybe "." (joinPair " ") targetModule ,if null targetType then "." else targetType ,targetItem] ++ replace [""] ["."] (lines targetDocs)@@ -34,7 +33,7 @@ Target (if url == "." then "" else url) (f pkg) (f modu) (if typ == "." then "" else typ) self (unlines $ replace ["."] [""] docs) where f "." = Nothing- f x = Just (first strPack $ word1 x)+ f x = Just $ word1 x -- write all the URLs, docs and enough info to pretty print it to a result -- and replace each with an identifier (index in the space) - big reduction in memory