cron-0.4.1.1: Cron datatypes and Attoparsec parser

Portabilityportable
MaintainerAndrew Rademacher <andrewrademacher@gmail.com>
Safe HaskellNone

System.Cron.Schedule

Description

 main :: IO ()
 main = do
        ...
        tids <- execSchedule $ do
            addJob job1 "* * * * *"
            addJob job2 "0 * * * *"
        print tids
        ...

 job1 :: IO ()
 job1 = putStrLn "Job 1"

 job2 :: IO ()
 job2 = putStrLn "Job 2"

Synopsis

Documentation

data Job Source

Scheduling Monad

Constructors

Job CronSchedule (IO ()) 

Instances

newtype ScheduleT m a Source

Constructors

ScheduleT 

Fields

unSchedule :: StateT Jobs (ExceptT ScheduleError m) a
 

class MonadSchedule m whereSource

Methods

addJob :: IO () -> String -> m ()Source

Instances

execSchedule :: Schedule () -> IO [ThreadId]Source

Schedule all of the jobs to run at appropriate intervals. Each job that is launched gets a scheduling thread to itself. Each time a scheduling thread launches a job, the job is forked onto a new thread. This means that if a job throws an excpetion in IO, its thread will be killed, but it will continue to be scheduled in the future.