4 ms·
Haskell has monadic loops (https://hackage.haskell.org/package/monad-loops-0.4.3/docs/Control-Monad-Loops.html https://hackage.haskell.org/package/monad-loops-0
by wwright 7y ago
Haskell has monadic loops (https://hackage.haskell.org/package/monad-loops-0.4.3/docs/Control-Monad-Loops.html https://hackage.haskell.org/package/monad-loops-0.4.3/docs/C...):
let limit = secondsToDiffTime 60
start <- getCurrentTime
iterateUntil id $ andM
[ someApplicationLogicReturningBoolean
, do
now <- getCurrentTime
return $ (diffUtcTime start now) >= limit
]
This is a really rough sketch from someone who just looked all this up, of course :-)
Recursion is probably still much more natural here.