Expanding Data.Foldable documentation with overview prose (pre-MR feedback requested)

Ben Franksen ben.franksen at online.de
Sun Dec 27 10:20:00 UTC 2020


Am 25.12.20 um 09:04 schrieb Viktor Dukhovni:
>> On Dec 24, 2020, at 7:22 PM, Viktor Dukhovni <ietf-dane at dukhovni.org> wrote:
>>
>> If the overall approach is sound, it might perhaps now make sense to add
>> some brief text also in each function synopsis that classifies it as
>> strict recursive, lazy corecursive, or some hybrid.  But perhaps just
>> having that level of detail at the bottom is sufficient?
> 
> I've forked the document to explore carving out a third-class
> of folds, the *short-circuit* folds, that though they also
> are based on `foldr`, are not really corecursive, they just
> might terminate early, but produce only a single final result.
> 
> This variant is at: <https://imrryr.org/~viktor/haskell/foldable-doc/Data-Foldable-v2.html
> The original is at: <https://imrryr.org/~viktor/haskell/foldable-doc/Data-Foldable.html>
> 
> Is the new version heading in the right direction?  Is anyone interested
> in helping out to get the initial draft in good enough shape for an MR?

One minor nitpick:

Short-circuit reduction, which examines some initial sequence of the
input elements, but stops once a termination condition is met, returning
a final result based only on the elements considered to that point. The
                                                    ^ up

This one should really be fixed:

remaining elements are not considered. The input should generally be
finite, because the termination condition but otherwise be never met.
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        hard to understand because of grammar mistakes

Otherwise: very well written.

Why are the class laws part of the Overview and not of the class
documentation proper as usual?

Cheers
Ben



More information about the Libraries mailing list