[Haskell-cafe] Re: [Long, probably not-beginners anymore] Parallel folds and folds as arrows (was: Re: Re: When, if ever, does Haskell "calculate once"?)

Maciej Piechotka uzytkownik2 at gmail.com
Thu May 6 22:07:51 EDT 2010


On Fri, 2010-05-07 at 02:15 +0100, Maciej Piechotka wrote:
> > myArr :: Num a => FoldlArrow a (a, a) (a, a)
> > myArr = proc (l, s) -> do e <- element -< ()
> >                           returnA -< (l + 1, s + e)
> 
> It starts consuming memory as well. Somewhere is lazy passing of value
> but I cannot find where 

Ok. Should be:
myArr :: Num a => FoldlArrow a (a, a) (a, a)
myArr = proc (l, s) -> do e <- element -< ()
                          let !l' = l + 1
                          let !s' = s + e
                          returnA -< (l', s')

Regards
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20100506/98a32658/attachment.bin


More information about the Haskell-Cafe mailing list