ndmitchell / hoogle

Haskell API search engine
http://hoogle.haskell.org/
Other
753 stars 137 forks source link

Module re-exports aren't followed when using scope restriction #93

Open mgsloan opened 9 years ago

mgsloan commented 9 years ago

Currently, if you do an exact search for Typeable +Data.Data, you won't get any results, despite Data.Data exporting Typeable. It seems like, ideally, module re-exports would be followed when using a scope restriction. This is desired, because then if you have an explicit import of an identifier, you can easily do an exact hoogle search to get its docs.

Here's a repro:

import Hoogle

main = do
    db <- loadDatabase "default.hoo"
    input <- getLine
    let Right q = parseQuery Haskell input
    print (search db (queryExact (Just UnclassifiedItem) q))
$ runhaskell HoogleRepro.hs 
Typeable +Data.Data
[]
$ runhaskell HoogleRepro.hs 
Data +Data.Data
[(Exact,Result {locations = [("http://hackage.haskell.org/packages/archive/base/latest/doc/html/Data-Data.html",[("http://hackage.haskell.org/package/base/","base"),("http://hackage.haskell.org/packages/archive/base/latest/doc/html/Data-Data.html","Data.Data")])], self = Tags [TagEmph (Str "module"),Str " Data.",TagBold (Tags [TagEmph (Str "Data")])], docs = Tags [Str "\"Scrap your boilerplate\" --- Generic programming in Haskell. See ",TagLink "" (Str "http://www.cs.vu.nl/boilerplate/"),Str ". This module provides the ",TagLink "" (Str "Data"),Str " class with its primitives for generic programming, along with instances for many datatypes. It corresponds to a merge between the previous ",TagLink "" (Str "Data.Generics.Basics"),Str " and almost all of ",TagLink "" (Str "Data.Generics.Instances"),Str ". The instances that are not present in this module were moved to the Data.Generics.Instances module in the syb package.\n\nFor more information, please visit the new SYB wiki: ",TagLink "" (Str "http://www.cs.uu.nl/wiki/bin/view/GenericProgramming/SYB"),Str ". "]}),(Exact,Result {locations = [("http://hackage.haskell.org/packages/archive/fay-base/latest/doc/html/Data-Data.html",[("http://hackage.haskell.org/package/fay-base/","fay-base"),("http://hackage.haskell.org/packages/archive/fay-base/latest/doc/html/Data-Data.html","Data.Data")])], self = Tags [TagEmph (Str "module"),Str " Data.",TagBold (Tags [TagEmph (Str "Data")])], docs = Tags []})]
ndmitchell commented 9 years ago

I don't think the information output by haddock --hoogle even contains that data, so I think it probably needs adding there first.