The ticker package

[ Tags: bsd3, concurrency, library ] [ Propose Tags ]

A concurrent utility inspired by Ticker in golang

[Skip to Readme]


Versions 1.0.0
Change log
Dependencies async (>=2.0 && <3), base (>=4.7 && <5), safe-exceptions (>=0.1) [details]
License BSD3
Copyright 2017 OSANAI Kazuyoshi
Author OSANAI Kazuyoshi
Category Concurrency
Home page
Bug tracker
Source repository head: git clone
Uploaded Mon Aug 21 16:22:44 UTC 2017 by syocy
Updated Tue Aug 22 07:20:08 UTC 2017 by syocy to revision 1   [What is this?]
Distributions NixOS:1.0.0
Downloads 279 total (138 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2017-08-21 [all 1 reports]
Hackage Matrix CI




Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

For package maintainers and hackage trustees

Readme for ticker-1.0.0

[back to package description]


A utility of concurrent programming in Haskell, inspired by Ticker in Go.

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
-- Tick!Tick!Tick!

More functions are defined in src/Control/Concurrent/Ticker.hs.