[Haskell-cafe] What's the best way to give up?

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Sat Sep 6 11:10:34 EDT 2008


On 2008 Sep 6, at 7:30, David F. Place wrote:
> 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.

http://www.haskell.org/haskellwiki/Timing_out_computations

-- 
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH




More information about the Haskell-Cafe mailing list