[GHC] #876: Length is not a good consumer

George Colpitts george.colpitts at gmail.com
Tue Dec 13 12:24:48 UTC 2016


Joachim, thanks for the kind words but I'll be more careful not to waste
people's time with bad bug reports like that.

I got confused; when I  I google   "haskell list length" I end up at
https://hackage.haskell.org/package/base-4.9.0.0/docs/*Data-List*.html
<https://hackage.haskell.org/package/base-4.9.0.0/docs/Data-List.html>.
When I look at the source code for length by clicking on "Source" It takes
me to the start of the file
https://hackage.haskell.org/package/base-4.9.0.0/docs/src/*Data.Foldable*
.html#length
<https://hackage.haskell.org/package/base-4.9.0.0/docs/src/Data.Foldable.html#length>.
instead of the definition of length in
https://hackage.haskell.org/package/base-4.9.0.0/docs/src/*GHC.List.*
html#length
<https://hackage.haskell.org/package/base-4.9.0.0/docs/src/GHC.List.html#length>
.

To me, this seems like a bug in haddock. In *Data.List*.html when I click
on the source code for init I go to
https://hackage.haskell.org/package/base-4.9.0.0/docs/src/GHC.List.html#init.
This is the file  I should go to for the source code for length also.
Perhaps the problem is that the type of length in Data.List is Foldable t
=> t a -> Int while init is [a] -> [a] ? Should I file a haddock bug for
the preceding?

There seems to be two minor related problems with the Users Guide
(8.0.1.20161117) in section 10.32.6,List fusion. First, it should mention
length as a good consumer. Secondly, it says: "If you want to write your
own good consumers or producers, look at the Prelude definitions of the
above functions to see how to do so." However if you go to
https://hackage.haskell.org/package/base-4.9.0.0/docs/Prelude.html and look
at the source code for length you end up at
https://hackage.haskell.org/package/base-4.9.0.0/docs/src/Data.Foldable.html#length
which
is not a good consumer. I think the User's Guide should be changed to
replace "Prelude" with "Data.List" in the quoted sentence. I'll file a doc
bug on the User's Guide for these two issues.  Also making a function
implement list fusion is not always easy, e.g. the bug, length is not a
good consumer, was open for six years before being fixed. Thus I will
suggest in the bug that we delete "readily" and change "Prelude" to
"Data.List" in "This list could readily be extended; if there are Prelude
functions that you use a lot which are not included, please tell us."

Of course the preceding is not an excuse for giving space allocations of
interpreted code when I reopened the bug but at that point I was convinced
that there was a problem and wasn't critical of the "evidence" I was giving
to support my claim.

Thanks
George


On Mon, Dec 12, 2016 at 11:44 AM Joachim Breitner <mail at joachim-breitner.de>
wrote:

Am Montag, den 12.12.2016, 12:44 +0000 schrieb George Colpitts:
> my apologies, sorry for the terrible bug report

No worries! Better a bug report closed as invalid than a real bug
unreported.

Greetings,
Joachim

--
--
Joachim “nomeata” Breitner
  mail at joachim-breitner.dehttps://www.joachim-breitner.de/
  XMPP: nomeata at joachim-breitner.de • OpenPGP-Key: 0xF0FBF51F
  Debian Developer: nomeata at debian.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20161213/cf964b12/attachment.html>


More information about the ghc-devs mailing list