typelevel / cats

Lightweight, modular, and extensible library for functional programming.
https://typelevel.org/cats/
Other
5.25k stars 1.21k forks source link

Document instances of type classes #1287

Open chuwy opened 8 years ago

chuwy commented 8 years ago

I think it would be very nice to have list of instances for which type class is implemented on type class documentation page. For example, on Functor page we can list:

I like that we have this on Hackage, but for cats this probably should be done manually, (although I think I heard something about support of type classes in scaladoc) to concisely highlight implementation details and just because I doubt this can be autogenerated.

I think this can highly improve approachability in following ways:

ceedubs commented 7 years ago

@chuwy would you consider this to be solved by #1565? The instances aren't listed on the type class page itself, but personally I think that the high-level overview provided by the table might be even more helpful, since it allows you to compare which instances are available for which types.

chuwy commented 7 years ago

Hi @ceedubs,

Yes, that PR covers most I wanted to see.

However, there's one problem - namely it doesn't cover too many type classes (Traverse, Semigroup, Arrow etc) and data types (Future, Kleisli etc). I can take over that table and add everything it misses, but I afraid that would make it bloated and unusable.

So if we think that listing instances (more Hackage-way) on type class page is bad idea and cannot come up with anything better (I cannot) then I'm happy to close this.

ceedubs commented 7 years ago

@chuwy ah, that's a good point. I like the idea of listing instances on the type class page; I'm just concerned about the maintenance. We don't have an automated way to keep it up-to-date, and I suspect that it will be prone to falling out-of-date. It could be useful even if it isn't perfect though.

chuwy commented 7 years ago

@ceedubs getting out-of-date was my concern as well, but I guess that will be not such a problem when cats reach 1.0.

edmundnoble commented 7 years ago

:+1: to listing instances on the type class page. Sounds useful.

kubukoz commented 6 years ago

I think it should be possible to find all the instances we define using Scalameta...

Possibly even something like A, Monad[F] => Monad[Kleisli[F, A, ?]].

Do you think it's worth taking a look? I'd gladly try doing a prototype myself, if it sounds like a good idea.

kailuowang commented 6 years ago

@kubukoz sounds a good idea to me.