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

2008-09-06 Thread Derek Elkins
On Sat, 2008-09-06 at 12:17 -0400, David F. Place wrote: > On Sat, 2008-09-06 at 11:10 -0400, Brandon S. Allbery KF8NH wrote: > > 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 th

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

2008-09-06 Thread David F. Place
On Sat, 2008-09-06 at 11:10 -0400, Brandon S. Allbery KF8NH wrote: > 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 ::

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

2008-09-06 Thread Brandon S. Allbery KF8NH
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

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

2008-09-06 Thread Christopher Lane Hinson
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? I don't know, but this seems relevant: http://www.haskell.org/pipermail/haskell-cafe/2005-October/011946.html I'd make a generic (i.e. higher-order) function that handles the

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

2008-09-06 Thread Arnar Birgisson
Hi there, On Sat, Sep 6, 2008 at 13:30, David F. Place <[EMAIL PROTECTED]> wrote: > 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

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

2008-09-06 Thread David F. Place
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