[Documentation] Annotate the non-total function in Data.Foldable as such
This merge request adds annotations to maximum
, minimum
, foldl1
and foldr1
,
to emphasise the non-total nature of these functions.
Moreover, when deemed useful, examples are added to show the behaviour of these functions under normal (non-empty structures) and abnormal (empty structures) circumstances.
I know that their documentation says and thus may only be applied to non-empty structures.
, but for beginners who are not used to
determine purity of a function from its type signature, the phrasing can be misleading, as it does not says what will happen if
the function is misused.
(Of course, these functions should have a constraint on NonEmpty a
but that is a whole other discussion).
You will find below the rendered docs for maximum
and minimum
, using collapsible subheadings.
Tracking: #17929