[Haskell-beginners] netwire accum delayed by one
Nathan Hüsken
nathan.huesken at posteo.de
Sat Nov 3 13:18:18 CET 2012
Hey,
With this netwire based program:
{-# LANGUAGE Arrows #-}
import Control.Wire
import Data.List
mainWire :: WireP () Double
mainWire = proc _ -> do
accum (+) 0 -< 1
main = do
wireLoop mainWire
wireLoop :: WireP () Double -> IO ()
wireLoop w' = do
let (mx, w) = stepWireP w' 1.0 ()
case mx of
Left x -> putStrLn $ show mx
Right x -> putStrLn $ show mx
wireLoop w
I get (output):
Right 0.0
Right 1.0
Right 2.0
...
Should the output not start with 1.0 (and not 0.0)? The accum should be
applied already in the first invocation, should it not?
Regards,
Nathan
More information about the Beginners
mailing list