[Haskell-cafe] Re: Re: semi-closed handles

Ben Franksen ben.franksen at online.de
Tue Apr 22 14:18:32 EDT 2008


Ryan Ingram wrote:

> 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.

I am almost sure that there is something in Control.Parallel.Strategies that
you can use (but too lazy to look it up now...)

Cheers
Ben



More information about the Haskell-Cafe mailing list