all tasks
This commit is contained in:
parent
b83f433714
commit
68f8f3e56b
14735 changed files with 178959 additions and 0 deletions
|
|
@ -0,0 +1,12 @@
|
|||
import System.Environment
|
||||
import Control.Concurrent
|
||||
import Control.Monad
|
||||
|
||||
sleepSort :: [Int] -> IO ()
|
||||
sleepSort values = do
|
||||
chan <- newChan
|
||||
forM_ values (\time -> forkIO (threadDelay (50000 * time) >> writeChan chan time))
|
||||
forM_ values (const (readChan chan >>= print))
|
||||
|
||||
main :: IO ()
|
||||
main = getArgs >>= sleepSort . map read
|
||||
Loading…
Add table
Add a link
Reference in a new issue