[Haskell-cafe] algebra/grammar/language for expressing time intervals

Jeremy Shaw jeremy at n-heptane.com
Mon Sep 14 18:58:00 EDT 2009


Hello,

I need some cron-like functionality for long running daemon written in  
Haskell.

I want to be able to schedule an event to be run:

   1. once, at a specific time
   2. some regularly scheduled time

I don't see an existing library to do this, so I am starting work on  
my own.

The first issue I am looking at is how to specify time intervals. The  
primary example I have looked at is cron. Cron is pretty good, but I  
don't see a way to do something like, run a job every other Wednesday.

I also want to be able to display the interval schedule to the user,  
allow them to modify it, and also save the schedule to disk and reload  
it. So this essentially means that the type for describing the  
intervals can not contain any functions.

Does anyone know of a good language for describing intervals? I want  
to be able to express things like:

  - run every other wednesday
  - run at 15 minutes past the hour
  - run at 15 minutes past the hour every wednesday
  - run at 15 and 25 minutes past the hour between the hours of 2 and  
6 AM.
  - run every weekday at 8AM unless it is a holiday (the list of  
holidays would be supplied).

Basically, everything you can express with cron, and a bit more.

Is there any existing languages/grammars/algebras for this that I  
should look at?

thanks!
- jeremy


More information about the Haskell-Cafe mailing list