Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing links to GHC.OldList when re-exporting Foldable #9

Open
sjakobi opened this issue Jul 17, 2018 · 9 comments
Open

Missing links to GHC.OldList when re-exporting Foldable #9

sjakobi opened this issue Jul 17, 2018 · 9 comments

Comments

@sjakobi
Copy link
Owner

sjakobi commented Jul 17, 2018

With

module Lib (Foldable(..)) where

I get

Warning: Lib: could not find link destinations for:
    foldl foldl1 foldr foldr1 Array

where previously the only warning was for Array.

@sjakobi
Copy link
Owner Author

sjakobi commented Jul 18, 2018

(I was also confused about fold, foldr', foldl' and toList missing from the Foldable methods but that's just because Prelude doesn't re-export them.)

@alexbiehl
Copy link

Is this a bug in renamer? It needs to consider the modules where fold, foldr', ... originate.

@sjakobi
Copy link
Owner Author

sjakobi commented Jul 18, 2018

The chain of re-exports involved here is quite impressive:

  • GHC.OldList re-exports the entire module Data.OldList
  • Data.OldList re-exports functions from GHC.List
  • GHC.List defines foldl, foldl1 and foldr1, and re-exports foldrfrom GHC.Base

@sjakobi
Copy link
Owner Author

sjakobi commented Jul 19, 2018

Unsurprisingly the iface docs section for the sample module is quite empty:

docs:
  Just identifier env:
       module header:
         Nothing
       declaration docs:
       arg docs:
       documentation structure:
         avails:
           [Foldable{Foldable, elem, foldMap, foldl, foldl1, foldr, foldr1,
                     length, maximum, minimum, null, product, sum;}]
       named chunks:
       haddock options:
       language:
         Just Haskell2010
       language extensions:
       declaration locations:
       splice locations:

What I don't understand is why the links LinkEnv we construct in processModules contains all kinds of stuff including functions from GHC.Integer.GMP.Internals but not the list folds.

@sjakobi
Copy link
Owner Author

sjakobi commented Jul 19, 2018

What I don't understand is why the links LinkEnv we construct in processModules contains all kinds of stuff including functions from GHC.Integer.GMP.Internals but not the list folds.

Maybe that's related to GHC.Base and GHC.List having {-# OPTIONS_HADDOCK hide #-}?

@sjakobi
Copy link
Owner Author

sjakobi commented Jul 19, 2018

Replacing the hide option in GHC.Base and GHC.List with not-home alleviates the problem:

We now get the missing links, but they direct to GHC.List instead of GHC.OldList. Since GHC.OldList recommends using GHC.List instead, that's not too bad.

There still appears to be an underlying problem with the way we construct the LinkEnv though.

@sjakobi
Copy link
Owner Author

sjakobi commented Jul 20, 2018

For posterity, the attached file shows how the processModules.extLinks for a package depending only on base are composed with the current ghc- and haddock-head: link-env.txt

@sjakobi
Copy link
Owner Author

sjakobi commented Jul 23, 2018

For posterity, the attached file shows how the processModules.extLinks for a package depending only on base are composed with the current ghc- and haddock-head: link-env.txt

Interestingly we do find GHC.Base.foldr linking to GHC.OldList there.

I should check whether the LinkEnv I get with my version of haddock is the same.

@alexbiehl
Copy link

alexbiehl commented Jul 23, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants