Hello everyone. I have a quick question about Time. <br><br>I was talking about Haskell on the Arch Linux forums today, and someone was trying to put together code that would print a series of periods for, say, 5 minutes. I felt like using 'until' would be the most correct way of going about it, but when I tried to do it...<br>
<br><br>import Time<br><br>makeLater :: ClockTime -> ClockTime<br>makeLater t = addToClockTime (TimeDiff 0 0 0 0 0 5 0) t<br><br>updateTime :: ClockTime -> ClockTime<br>updateTime t = t<br><br>main = do<br>
start <- getClockTime<br> until ((==) $ makeLater start) (updateTime) start<br> putStrLn "done"<br><br>Now, updateTime isn't correct. And this wouldn't print any periods. But GHC is giving me errors:<br>
<br>$ runhaskell temp.hs<br><br>temp.hs:11:2:<br> Couldn't match expected type `IO t'<br> against inferred type `ClockTime'<br> In the expression:<br> until ((==) $ makeLater start) (updateTime) start<br>
In a 'do' expression:<br> until ((==) $ makeLater start) (updateTime) start<br> In the expression:<br> do start <- getClockTime<br> until ((==) $ makeLater start) (updateTime) start<br>
putStrLn "done"<br><br>I'm not sure where IO t is coming from at all. Am I even on the right track? How would you write this code?<br>