ndmitchell / ndmitchell/hoogle

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

Open
#93 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

haddock
Dominant language
Haskell
Stars
803
Forks
152
PR merge metrics
No merged PRs in 30d

Description

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 []})]

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the HoogleRepro.hs example with the exact query Typeable +Data.Data and compare it with the Data +Data.Data result. Trace the exact-search path and module re-export handling; done means the restricted exact search returns the re-exported Typeable result.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
search
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.