[Haskell-cafe] RFC: in haddock, collapse instances by default

Ian Denhardt ian at zenhack.net
Thu Jan 3 05:23:58 UTC 2019


Quoting Li-yao Xia (2019-01-02 11:18:41)

> For a motivating example, I can point to the Prelude we all love.
>
> https://hackage.haskell.org/package/base-4.12.0.0/docs/Prelude.html
>
> We are immediately welcomed by half a page of instances of Bool, which
> is not quite bad, but classes have the most impressive instance lists,
> as you may see when you reach Eq.
>
> Many packages, even commonly used ones, have the same issue. For an
> extreme example, see the scrollbar jump when you fold the instance
> list of Apply in singletons.
>
> https://hackage.haskell.org/package/singletons-2.5.1/docs/Data-Singletons.html#t:Apply

Another example where this gets a little ridiculous is my capnp package,
which defines a few type classes with instances for most types in the
generated code, e.g:

https://hackage.haskell.org/package/capnp-0.3.0.0/docs/Data-Capnp-Classes.html

It's not quite as absurd as the singletons package, but from eyeballing
the size of my scrollbar I'd guess that the instance lists are 80-90% of
that page.

> Of course, instance lists also contain quite important information.
> Would it become too easy to miss if it were hidden by default? Would a
> more fine-grained alternative be better?

Personally I rarely use them.

It was mentioned on the Github issue/pr as well, but I think a
collapse/expand all would be a good idea. My personal inclination would
be to have it collapsed by default, though I feel less strongly about
this.

-Ian


More information about the Haskell-Cafe mailing list