ticker-hs

所属分类:超算/并行计算
开发工具:Haskell
文件大小:0KB
下载次数:0
上传日期:2017-09-13 07:35:24
上 传 者sh-1993
说明:  Haskell中并发编程的实用程序,由golang.中的Ticker设计。,
(A utility for concurrent programming in Haskell, insipired by Ticker in golang.,)

文件列表:
.travis.yml (802, 2017-09-13)
CHANGELOG.md (46, 2017-09-13)
LICENSE (1528, 2017-09-13)
Setup.hs (46, 2017-09-13)
doctest/ (0, 2017-09-13)
doctest/Doctest.hs (142, 2017-09-13)
src/ (0, 2017-09-13)
src/Control/ (0, 2017-09-13)
src/Control/Concurrent/ (0, 2017-09-13)
src/Control/Concurrent/Ticker.hs (2561, 2017-09-13)
stack.yaml (2171, 2017-09-13)
test/ (0, 2017-09-13)
test/Control/ (0, 2017-09-13)
test/Control/Concurrent/ (0, 2017-09-13)
test/Control/Concurrent/TickerSpec.hs (1005, 2017-09-13)
test/Spec.hs (44, 2017-09-13)
ticker.cabal (1779, 2017-09-13)

[![Travis](https://img.shields.io/travis/syocy/ticker-hs.svg)](https://travis-ci.org/syocy/ticker-hs) [![Hackage](https://img.shields.io/hackage/v/ticker.svg)](https://hackage.haskell.org/package/ticker) # ticker A utility of concurrent programming in Haskell, inspired by [Ticker](https://golang.org/pkg/time/#Ticker) in Go. ```haskell import Control.Concurrent.Ticker (newTicker) import Control.Concurrent.Chan (getChanContents) import Control.Concurrent.Async (async, cancel) import Control.Monad (forM_) main :: IO () main = do (chan, cancelTicker) <- newTicker (10^3 * 100) -- tick rate: 100ms chanStream <- getChanContents chan thread <- async $ forM_ chanStream $ \_ -> do putStr "Tick!" threadDelay (10^3 * 350) -- wait 3 ticks putStrLn "" cancel thread cancelTicker -- Tick!Tick!Tick! ``` More functions are defined in `src/Control/Concurrent/Ticker.hs`.

近期下载者

相关文件


收藏者