Hello community, here is the log from the commit of package hoogle for openSUSE:Factory checked in at 2017-06-04 01:59:42 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/hoogle (Old) and /work/SRC/openSUSE:Factory/.hoogle.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "hoogle" Sun Jun 4 01:59:42 2017 rev:2 rq:499747 version:5.0.12 Changes: -------- --- /work/SRC/openSUSE:Factory/hoogle/hoogle.changes 2017-05-09 18:15:51.273174044 +0200 +++ /work/SRC/openSUSE:Factory/.hoogle.new/hoogle.changes 2017-06-04 01:59:43.325107018 +0200 @@ -1,0 +2,5 @@ +Thu May 18 09:52:26 UTC 2017 - psim...@suse.com + +- Update to version 5.0.12 with cabal2obs. + +------------------------------------------------------------------- Old: ---- hoogle-5.0.10.tar.gz New: ---- hoogle-5.0.12.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ hoogle.spec ++++++ --- /var/tmp/diff_new_pack.iTdciC/_old 2017-06-04 01:59:43.813038087 +0200 +++ /var/tmp/diff_new_pack.iTdciC/_new 2017-06-04 01:59:43.817037522 +0200 @@ -18,7 +18,7 @@ %global pkg_name hoogle Name: %{pkg_name} -Version: 5.0.10 +Version: 5.0.12 Release: 0 Summary: Haskell API Search License: BSD-3-Clause ++++++ hoogle-5.0.10.tar.gz -> hoogle-5.0.12.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hoogle-5.0.10/CHANGES.txt new/hoogle-5.0.12/CHANGES.txt --- old/hoogle-5.0.10/CHANGES.txt 2017-04-17 16:46:12.000000000 +0200 +++ new/hoogle-5.0.12/CHANGES.txt 2017-05-07 00:14:37.000000000 +0200 @@ -1,5 +1,9 @@ Changelog for Hoogle +5.0.12 + #210, expose targetInfo and targetSearchDisplay +5.0.11 + #209, add a defaultDatabaseLocation function 5.0.10 #205, change how the link URL is computed #206, put newer versions of a package first diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hoogle-5.0.10/hoogle.cabal new/hoogle-5.0.12/hoogle.cabal --- old/hoogle-5.0.10/hoogle.cabal 2017-04-17 16:46:12.000000000 +0200 +++ new/hoogle-5.0.12/hoogle.cabal 2017-05-07 00:14:37.000000000 +0200 @@ -1,7 +1,7 @@ cabal-version: >= 1.18 build-type: Simple name: hoogle -version: 5.0.10 +version: 5.0.12 license: BSD3 license-file: LICENSE category: Development diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hoogle-5.0.10/src/Action/CmdLine.hs new/hoogle-5.0.12/src/Action/CmdLine.hs --- old/hoogle-5.0.10/src/Action/CmdLine.hs 2017-04-17 16:46:12.000000000 +0200 +++ new/hoogle-5.0.12/src/Action/CmdLine.hs 2017-05-07 00:14:36.000000000 +0200 @@ -2,7 +2,8 @@ {-# OPTIONS_GHC -fno-warn-missing-fields -fno-cse #-} module Action.CmdLine( - CmdLine(..), Language(..), getCmdLine, + CmdLine(..), Language(..), + getCmdLine, defaultDatabaseLang, defaultGenerate, whenLoud, whenNormal ) where @@ -69,14 +70,18 @@ } deriving (Data,Typeable,Show) +defaultDatabaseLang :: Language -> IO FilePath +defaultDatabaseLang lang = do + dir <- getAppUserDataDirectory "hoogle" + return $ dir </> "default-" ++ lower (show lang) ++ "-" ++ showVersion version ++ ".hoo" + getCmdLine :: [String] -> IO CmdLine getCmdLine args = do args <- withArgs args $ cmdArgsRun cmdLineMode -- fill in the default database args <- if database args /= "" then return args else do - dir <- getAppUserDataDirectory "hoogle" - return $ args{database=dir </> "default-" ++ lower (show $ language args) ++ "-" ++ showVersion version ++ ".hoo"} + db <- defaultDatabaseLang $ language args; return args{database=db} -- fix up people using Hoogle 4 instructions args <- case args of diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hoogle-5.0.10/src/Action/Search.hs new/hoogle-5.0.12/src/Action/Search.hs --- old/hoogle-5.0.10/src/Action/Search.hs 2017-04-17 16:46:12.000000000 +0200 +++ new/hoogle-5.0.12/src/Action/Search.hs 2017-05-07 00:14:36.000000000 +0200 @@ -1,6 +1,9 @@ {-# LANGUAGE TupleSections, RecordWildCards, ScopedTypeVariables #-} -module Action.Search(actionSearch, withSearch, search, action_search_test) where +module Action.Search(actionSearch, withSearch, search, + targetInfo, + targetResultDisplay, + action_search_test) where import Control.Monad.Extra import Control.DeepSeq @@ -32,23 +35,14 @@ if null compare_ then do (q, res) <- return $ search store $ parseQuery $ unwords query whenLoud $ putStrLn $ "Query: " ++ unescapeHTML (renderQuery q) - let disp Target{..} = unwords $ - fmap fst (maybeToList targetModule) ++ - [targetItem] ++ - ["-- " ++ targetURL | link] - let (shown, hidden) = splitAt count $ nubOrd $ map disp res + let (shown, hidden) = splitAt count $ nubOrd $ map (targetResultDisplay link) res if null res then putStrLn "No results found" else if info then do - let Target{..} = head res - putStrLn (unHTML targetItem) - let packageModule = map fst $ catMaybes [targetPackage, targetModule] - unless (null packageModule) $ do - putStrLn (unwords packageModule) - putStrLn (unHTML targetDocs) + putStr $ targetInfo $ head res else do let toShow = if numbers && not info then addCounter shown else shown - putStr $ unlines $ map unHTML toShow + putStr $ unlines toShow when (hidden /= []) $ do whenNormal $ putStrLn $ "-- plus more results not shown, pass --count=" ++ show (count+10) ++ " to see more" else do @@ -57,7 +51,21 @@ _ -> error $ "Expected a type signature, got: " ++ x putStr $ unlines $ searchTypesDebug store (parseType $ unwords query) (map parseType compare_) - where unHTML = unescapeHTML . innerTextHTML +-- | Returns the details printed out when hoogle --info is called +targetInfo :: Target -> String +targetInfo Target{..} = + unlines $ [ unHTML targetItem ] ++ + [ unwords packageModule | not $ null packageModule] ++ + [ unHTML targetDocs ] + 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 fst (maybeToList targetModule) ++ + [targetItem] ++ + ["-- " ++ targetURL | link] addCounter :: [String] -> [String] addCounter = zipWith (\i x -> show i ++ ") " ++ x) [1..] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hoogle-5.0.10/src/General/Util.hs new/hoogle-5.0.12/src/General/Util.hs --- old/hoogle-5.0.10/src/General/Util.hs 2017-04-17 16:46:12.000000000 +0200 +++ new/hoogle-5.0.12/src/General/Util.hs 2017-05-07 00:14:36.000000000 +0200 @@ -11,7 +11,7 @@ showUTCTime, strict, withs, - escapeHTML, unescapeHTML, innerTextHTML, tag, tag_, + escapeHTML, unescapeHTML, innerTextHTML, unHTML, tag, tag_, takeSortOn, Average, toAverage, fromAverage, inRanges, @@ -180,6 +180,9 @@ innerTextHTML (x:xs) = x : innerTextHTML xs innerTextHTML [] = [] +unHTML :: String -> String +unHTML = unescapeHTML . innerTextHTML + isUpper1 (x:xs) = isUpper x isUpper1 _ = False diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hoogle-5.0.10/src/Hoogle.hs new/hoogle-5.0.12/src/Hoogle.hs --- old/hoogle-5.0.10/src/Hoogle.hs 2017-04-17 16:46:12.000000000 +0200 +++ new/hoogle-5.0.12/src/Hoogle.hs 2017-05-07 00:14:36.000000000 +0200 @@ -1,9 +1,11 @@ -- | High level Hoogle API module Hoogle( - Database, withDatabase, searchDatabase, + Database, withDatabase, searchDatabase, defaultDatabaseLocation, Target(..), URL, - hoogle + hoogle, + targetInfo, + targetResultDisplay ) where import Control.DeepSeq (NFData) @@ -27,6 +29,10 @@ withDatabase :: NFData a => FilePath -> (Database -> IO a) -> IO a withDatabase file act = storeReadFile file $ act . Database +-- | The default location of a database +defaultDatabaseLocation :: IO FilePath +defaultDatabaseLocation = defaultDatabaseLang Haskell + -- | Search a database, given a query string, produces a list of results. searchDatabase :: Database -> String -> [Target] searchDatabase (Database db) query = snd $ search db $ parseQuery query