Functional reactive programming library
#11stepWire can't handle large time delays
The attached program takes an unreasonable amount of time to return (if it ever does — I've never waited long enough)
I'm having trouble uploading the file, so here it is:
module Main where import Control.Wire import FRP.Netwire import Prelude hiding ((.), id) import System.IO import Debug.Trace import Control.Concurrent
netwireIsCool :: (Show t, Fractional t, HasTime t s) => Wire s () IO () String netwireIsCool = (fmap show time) <> netwireIsCool'
netwireIsCool' :: (Fractional t, HasTime t s) => Wire s () IO a String netwireIsCool' = for 2 . pure "Once upon a time..." --> for 3 . pure "... games were completely imperative..." --> for 2 . pure "... but then..." --> for 10 . (pure "Netwire 5! " <> anim) --> netwireIsCool'
where anim = holdFor 0.5 . periodic 1 . pure "Hoo..." <|> pure "...ray!"
main :: IO () main = do (ds, s) <- stepSession clockSession_ (mx, w) <- stepWire netwireIsCool ds (Right ()) putStrLn "before delay" threadDelay 10000000 putStrLn "after delay" (ds, s) <- stepSession s stepWire netwireIsCool ds (Right ()) return ()
Comments don't retain formatting. Here it is: http://lpaste.net/5442109058821652480