
Hi, all. Say I have a function solve which is a constraint solver. It reconfigures its input to be a solution. If there is no solution, it returns the input. solve :: a -> Either a a solve input output = maybe (Left input) Right $ solve' input If there is a solution, it finds it in a few seconds. If there is no solution, it goes away for days proving that. So, I'd like to give up on it if it doesn't return in a few seconds. I can think of several ways of doing that. I could keep a tally of the number of variable assignments and give up when it reaches an impossibly huge number. I could change the type to a -> IO (Either a a ) and use getCPUTime. Is there a standard way to do this? Can you think of another way to do it? Cheers, David