haddock icon indicating copy to clipboard operation
haddock copied to clipboard

Show concrete associated types

Open sjakobi opened this issue 8 years ago • 7 comments

In the following snippet from the docs for Data.Functor.Rep I wonder why haddock shows only the kind of the associated Rep type:

bildschirmfoto vom 2017-08-06 21-43-14

Wouldn't it be better to see type Rep (Identity :: * -> *) = () instead?

sjakobi avatar Aug 06 '17 19:08 sjakobi

Yes, this is probably a good idea!

alexbiehl avatar Aug 07 '17 14:08 alexbiehl

The same problem shows up for associated data families.

harpocrates avatar Jul 08 '18 18:07 harpocrates

@harpocrates Do we have this data from what Haddock parses or does it need a deeper addition to what it can do? In other terms, is that a displaying issue, or a parsing issue?

Kleidukos avatar May 08 '20 16:05 Kleidukos

@harpocrates Do we have this data from what Haddock parses or does it need a deeper addition to what it can do? In other terms, is that a displaying issue, or a parsing issue?

This is a deeper addition, but not a parsing/display issue. The information we need is available within GHC already, but Haddock would need to figure out how to extract it properly. Right now, the only bit of information we collect about class instances is the instance head (we figure out instance signatures later by substitution, using the instance head variables).

Querying the right type/data family instance might be tricky too - especially since there might just not be any instance (if, for instance, the type/data was omitted from the instance)!

harpocrates avatar May 09 '20 00:05 harpocrates

haddock

(An updated screenshot FWIW ^)

I agree that type family instances really ought to be in the haddocks. You can't understand any API that makes use of type families without clicking through to the source.

jberryman avatar Feb 22 '21 18:02 jberryman

@jberryman This looks great. :)

Kleidukos avatar Feb 22 '21 18:02 Kleidukos

@Kleidukos this is just the current hackage haddock style (but I agree it looks pretty nice :). One would like to see e.g.

type Uninterned InternedString = String

Just seeing type Uninterned InternedString isn't helpful

jberryman avatar Feb 23 '21 15:02 jberryman