haddock icon indicating copy to clipboard operation
haddock copied to clipboard

could not find link destination for data family

Open guibou opened this issue 6 years ago • 5 comments

The following code:

{-# LANGUAGE TypeFamilies #-}
module NewTypeExport where

class Foo t where
  data Bar t

data Biz

instance Foo Biz where
  data Bar Biz = Bar Biz

Generates the following warning:

Warning: NewTypeExport: could not find link destinations for:
    Type D:R:BarBiz0 Bar

When actually Bar Biz is visible, hence I don't understand the warning. That's similar to #1070, however I don't have any easy workaround for that one.

guibou avatar Jul 01 '19 15:07 guibou

Haddock doesn't do a great job in general with data families and data instances. Some thoughts:

  • Type is something added by Haddock (since all instances are reified from GHC internals) so we should always be able to link to it (perhaps it needs to be manually added to the renaming environment).
  • D:R:BarBiz0 is a mess to look at. I don't think we ever provide anchors to derived names... Perhaps the warning should start by filtering out names which satisfy isDerivedOccName?
  • Bar really should have a link destination. One day, when #897 gets merged, there will be a reasonable place to place such anchors.

harpocrates avatar Jul 01 '19 16:07 harpocrates

Type is something added by Haddock (since all instances are reified from GHC internals) so we should always be able to link to it (perhaps it needs to be manually added to the renaming environment).

My mistake for Type, I had not the -i ...../base.haddock list of flags.

guibou avatar Jul 01 '19 17:07 guibou

@guibou is this still reproducible?

Kleidukos avatar Apr 25 '24 18:04 Kleidukos

I see this issue a great deal when dealing with Generics. Specifically, when I use GeneralizedNewtypeDeriving and derive a Generic, it complains that it cannot find the link destination for the associated type family Rep instance.

jcmartin avatar Jul 01 '24 17:07 jcmartin

Thanks for the confirmation. :)

Kleidukos avatar Jul 01 '24 20:07 Kleidukos