[Haskell-cafe] Concurrency question
Dmitry V'yal
akamaus at gmail.com
Wed Sep 7 02:21:25 EDT 2005
Donald Bruce Stewart wrote:
> Can I ask if just using a `seq` works as well? That was enough (now I
> recall) for the watchdog code I posted earlier.
>
> -- Don
In my case this doesn't work
>timeout :: DeepSeq a => Int -> IO a -> IO (Maybe a)
>timeout n t = do res <- par_io timer thr --timer
> return res
> where thr = do res <- t
> return $! Just res
> timer = do threadDelay $ n * 1000
> return Nothing
It's probably because "resolve" function has type
> resolve :: CNF -> (Bool, [(Int,Int)])
So it should be sequenced deeper.
More information about the Haskell-Cafe
mailing list