inits

Aaron Denney wnoise at ofb.net
Sat Apr 8 15:04:49 EDT 2006


On 2006-04-08, Chris Kuklewicz <haskell at list.mightyreason.com> wrote:
>> Is the head of the inits of undefined really an error?
>> Since the head of inits []  is also []  ...
>> But if you really want that undefined to produce an error.. you could
>> just :
>>        inits' xn@(_:_) = zipWith take [0..] $ map (const xn) $ undefined:xn
>>        inits' _        = undefined
>> 
>> 
>
> Exactly.  Now inits' *is* a drop in replacement for inits.

Right, but the new spiffy inits seems to be a strict superset.  Does
anything plausibly depend on the strictness of the original.  I think it
was written that way for clarity, not for the strictness properties.

-- 
Aaron Denney
-><-



More information about the Libraries mailing list