[Haskell-cafe] Space Leak Help
Stefan O'Rear
stefanor at cox.net
Sun Feb 4 04:51:06 EST 2007
On Sun, Feb 04, 2007 at 09:45:12AM +0000, Dominic Steinitz wrote:
> > pad :: Num a => [a] -> [a]
> > pad = pad' 0
> > where pad' l [] | l `seq` False = undefined
Stupid typo, that should be:
where pad' l _ | l `seq` False = undefined
> > pad' l [] = [0x80] ++ ps ++ lb
> > where pl = (64-(l+9)) `mod` 64
> > ps = replicate pl 0x00
> > lb = i2osp 8 (8*l)
> > pad' l (x:xs) = x : pad' (l+1) xs
> >
> > The first alternative never succeeds, but to see that the compiler
> > must force the evaluation of 'l'.
More information about the Haskell-Cafe
mailing list