[Haskell-cafe] Haskell reference documentation, laws first or laws last?

Anthony Clayden anthony.d.clayden at gmail.com
Fri Sep 17 00:37:17 UTC 2021


Hi Viktor, really this is a quite different q than the thread talking
about a learner's experience.

You're writing deeply-technical detail not at all aimed at beginners.
There's a very broad range of reasons and prior knowledge for readers
of Library docos.

But I disagree with this:

> The beginner to intermediate users will be using the library and existing instances for some time before they start to write their own instances.

I'll want to write an instance of Foldable as soon as I've declared my
datatype, won't I? Or do you expect me to be folding only over Lists?

Speaking for myself, if I want to understand a function, I look first
at its type then its source definition.

The Laws for the particular Foldable example I don't understand at
all. I'd say: hide those Laws as far away as possible.

In fact, since the blasted FTP re-organisation of that library, I've
more or less given up. Too hard/too abstract/too much Category Theory.
What's an `Endo`?

Thank you for your efforts to document. I expect there's someone
you're helping. Not me. I don't think it's that the style "sucks".

This style and content is enough for me:
https://www.haskell.org/hugs/pages/libraries/base/Data-Foldable.html


> Of course the conjectured users who might most benefit from not being intimidated by being exposed to laws before they're ready to understand them might not be present on this forum...


I've gone well beyond the point of being intimidated by Category
Theorists. I find they're doing a splendid job of putting people off
getting to love Haskell as I used to. If you want to tell me off for
speaking out of turn, go ahead. (But this forum is the cafe, perhaps
this particular discussion should be on glasgow-haskell-users?)


AntC


On Thu, Sep 16, 2021 at 06:51:42PM -0400, David Feuer wrote:
>* The last time I went to look at the laws it took me a couple minutes to
*>* find them. I use them to write instances. Pretty important, IMO.
*
I agree the laws are important to document, I just don't think they
belong at the top of the module.  The beginner to intermediate users
will be using the library and existing instances for some time before
they start to write their own instances.

If more modules adopt something like the style of the new Data.Foldable,
experienced users will know to look for the laws at the end, if not
still present at the top of the module.

Of course perhaps the community would prefer the original Laws first
format, I'm fine with that emerging as the consensus.  Perhaps worthy
of a separate thread (made it so).

Of course the conjectured users who might most benefit from not being
intimidated by being exposed to laws before they're ready to understand
them might not be present on this forum...

--
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20210917/a272c422/attachment.html>


More information about the Haskell-Cafe mailing list