[Haskell-beginners] Netwire loop

Nathan Hüsken nathan.huesken at posteo.de
Wed Oct 31 17:21:05 CET 2012


Hi,
When testing this netwire sample program

{-# LANGUAGE Arrows #-}

import Control.Wire

mainWire :: WireP () Double
mainWire = proc i -> do
  rec
    value <- integral_ 0.0 -< oldValue
    oldValue <- delay 1.0 -< value
  returnA -< value

main = do
  wireLoop mainWire

wireLoop :: WireP () Double -> IO ()
wireLoop w' = do
    let (mx, w) = stepWireP w' 1.0 ()
    case mx of
      Left ex -> putStrLn $ "Inhibited:" ++ (show ex)
      Right x -> putStrLn $ "Produced:" ++ (show x)
    wireLoop w

I get this output:
NetwireTest: <<loop>>

But there should be not infinite loop, should there?
Regards,
Nathan



More information about the Beginners mailing list