[Haskell-cafe] Re: semi-closed handles

Ryan Ingram ryani.spam at gmail.com
Tue Apr 15 16:19:15 EDT 2008

On 4/15/08, ChrisK <haskell at list.mightyreason.com> wrote:
> A small idiomatic nitpick:  When I see (length s) gets computed and thrown
> away I wince at the wasted effort.  I would prefer (finiteSpine s):

On every piece of hardware I've seen, the actual calculation done by
"length" is basically free.  Compared to the cache misses you'll get
from traversing the list, or especially the disk access from reading
the file, it's vanishingly small.

It's also directly from the prelude and it's usually pretty clear to a
newbie what it's doing, as compared to "foldr (const id) () s" which
is on the path to "functional languages make no sense" land.  I
consider myself moderately experienced, and assuming that it
typechecks I know what it has to mean, but I can't just look at it and
know what it does like I can with "length".

If there was a standard "seqList" or "deepSeq", I'd use that instead.

  -- ryan

More information about the Haskell-Cafe mailing list