[Haskell-beginners] netwire accum delayed by one

Ertugrul Söylemez es at ertes.de
Sun Nov 4 06:22:05 CET 2012


Nathan Hüsken <nathan.huesken at posteo.de> wrote:

> > Accum is documented to behave like a left scan, which also starts
> > with the initial value.  The reason is that for most applications
> > you want the data dependency on the previous instant instead of on
> > the current. Many useful FRP constructs can be (and are) expressed
> > in terms of accum and accumT.
>
> While I understand the intention, I often have several accums (or
> integral which is expressed in terms of accum) chained. For example:
>
> speed :: WireP CollisionData Vector
> speed = accum collide initSpeed
>   where
>   collide = ...
>
> position :: WireP CollisionData Vector
> position = integral_ initPos . speed
>
> which delays the output by 2.
> Maybe there should also be a "non delaying" version of accum and
> integral? I must admit, I would prefer it to inset delay manually, but
> that probably just a matter of taste.

That's how earlier versions of Netwire worked, where you always needed
explicit delays, but that turned out to be very noisy in code.  However,
I see why you may want to have the non-delaying versions, so I have
added and released them as version 4.0.2.  Along with the change I also
worked around an apparent Haddock bug, which prevented the documentation
from being created for GHC 7.6, so now you get Haddocks, too.


Greets,
Ertugrul

-- 
Not to be or to be and (not to be or to be and (not to be or to be and
(not to be or to be and ... that is the list monad.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/beginners/attachments/20121104/b9c0355f/attachment.pgp>


More information about the Beginners mailing list