
Just a short question: If I'm not mistaken, there is no way in the "base" package to sleep for a given amount of time in portable a way. Of course there is System.Posix.Unistd.sleep and System.Posix.Unistd.usleep in the "unix" package, but shouldn't we have a similar feature in the "base" libraries? Or have I overlooked something obvious? Cheers, S.

You can use the timeout function http://www.haskell.org/pipermail/glasgow-haskell-users/2001-April/001816.htm... and simply wait for the exception. or, if you require less precision, you could just loop and check the System.Time until a certain amount of time has elapsed. Other than that, I don't think so. On Mon, 27 Oct 2003, Sven Panne wrote:
Just a short question: If I'm not mistaken, there is no way in the "base" package to sleep for a given amount of time in portable a way. Of course there is System.Posix.Unistd.sleep and System.Posix.Unistd.usleep in the "unix" package, but shouldn't we have a similar feature in the "base" libraries? Or have I overlooked something obvious?
Cheers, S.
_______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries
-- Hal Daume III | hdaume@isi.edu "Arrest this man, he talks in maths." | www.isi.edu/~hdaume

Hal Daume III wrote:
You can use the timeout function
http://www.haskell.org/pipermail/glasgow-haskell-users/2001-April/001816.htm...
and simply wait for the exception.
Hmmm, this will trade an OS dependency for a dependency on GHC, not really an attractive option...
or, if you require less precision, you could just loop and check the System.Time until a certain amount of time has elapsed. [...]
:-P * * * Cheers, S.

On Mon, Oct 27, 2003 at 06:44:40PM +0100, Sven Panne wrote:
Just a short question: If I'm not mistaken, there is no way in the "base" package to sleep for a given amount of time in portable a way. Of course there is System.Posix.Unistd.sleep and System.Posix.Unistd.usleep in the "unix" package, but shouldn't we have a similar feature in the "base" libraries? Or have I overlooked something obvious?
System.system("sleep 4") should be mostly portable. not sure if there is an equivalant thing to run on windows... -- --------------------------------------------------------------------------- John Meacham - California Institute of Technology, Alum. - john@foo.net ---------------------------------------------------------------------------

John Meacham wrote:
System.system("sleep 4")
should be mostly portable. not sure if there is an equivalant thing to run on windows...
Apart from the massive overkill of spawning a process for such simple task, this is definitely not portable. What about e.g. Mac OS X? No idea... Wolfgang Thaller wrote:
Do you consider Control.Concurrent.threadDelay to be portable enough?
Nope, that's exactly the part of Control.Concurrent which is guarded with #ifdef __GLASGOW_HASKELL__, so it won't work with Hugs and nhc98. Nevertheless, I'm sure every platform has a good way of sleeping, so my proposal is to move (u)sleep out of the unix package into the base libraries, but I'm not sure where exactly in the hierarchy it should be placed. Cheers, S.
participants (4)
-
Hal Daume III
-
John Meacham
-
Sven Panne
-
Wolfgang Thaller