[Haskell] timing/timeout (how to express that in Haskell)

Johannes Waldmann waldmann at imn.htwk-leipzig.de
Fri May 12 03:55:28 EDT 2006


What is the idiomatic way to say in (ghc) Haskell:
"run this computation for at most  x  seconds"
(e. g. it returns Boolean; imagine a primality test)
so I want something :: Int -> a -> Maybe a
with the guarantee that the result is
Just x  with  x  in whnf, or  Nothing.
I guess one answer is "that's not Haskell because
that's not a function". Sure, but I think I need it
anyways, so I would accept some  IO .. in the types.
Best regards,
-- 
-- Johannes Waldmann -- Tel/Fax (0341) 3076 6479/80 --
---- http://www.imn.htwk-leipzig.de/~waldmann/ -------



More information about the Haskell mailing list