Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion html/hoogle.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ $(function(){
if (!instant) return;
function getScope(){
var v = $scope ? $scope.val() : "";
return v == null || v == "set:stackage" ? "" : v;
return v == null || v == "set:stackage" || v == "set:all" ? "" : v;
}

var nowHoogle = $hoogle.val();
Expand Down
9 changes: 6 additions & 3 deletions src/Action/Server.hs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ replyServer log local links haddock store cdn home htmlDir scope Input{..} = cas

let qScope = let xs = grab "scope" in [scope | null xs && scope /= ""] ++ xs
let qSearch = grabBy (`elem` ["hoogle","q"])
let qSource = qSearch ++ filter (/= "set:stackage") qScope
let qSource = qSearch ++ filter (`notElem` ["set:stackage","set:all"]) qScope
let q = concatMap parseQuery qSource
let (q2, results) = search store q
let body = showResults local links haddock (filter ((/= "mode") . fst) inputArgs) q2 $
Expand Down Expand Up @@ -200,12 +200,15 @@ showResults local links haddock args query results = do
H.div ! H.class_ "links" $ H.a ! H.href (H.stringValue link) $ "Uses"
H.div ! H.class_ "from" $ showFroms local haddock is
H.div ! H.class_ "doc newline shut" $ H.preEscapedString targetDocs
H.ul ! H.id "left" $ -- if there's already a scope query we don't show subquery links because bots will get lost in a maze of links.
if (any isQueryScope query) then pure () else do
H.ul ! H.id "left" $ -- if there's already a restrictive scope query we don't show subquery links because bots will get lost in a maze of links.
if (any isRestrictiveScope query) then pure () else do
H.li $ H.b "Packages"
mconcat [H.li $ f cat val | (cat,val) <- itemCategories $ concat results, QueryScope True cat val `notElem` query]

where
isRestrictiveScope (QueryScope _ cat _) = cat /= "is"
isRestrictiveScope _ = False

useLink :: [Target] -> Maybe String
useLink [t] | isNothing $ targetPackage t =
Just $ "https://packdeps.haskellers.com/reverse/" ++ extractName (targetItem t)
Expand Down
Loading