Skip to content

Instantly share code, notes, and snippets.

View arnemileswinter's full-sized avatar

Arne Winter arnemileswinter

View GitHub Profile
@homam
homam / TimerRecursion.hs
Created July 25, 2015 13:31
Timer, setInterval in Haskell
import Control.Concurrent
import Control.Exception
setInterval :: Int -> a -> (a -> IO a) -> IO ()
setInterval microsecs a action = do
mvar <- newEmptyMVar
_ <- setInterval' microsecs a mvar action
takeMVar mvar