cron-0.2.0: Cron datatypes and Attoparsec parser

Copyright(c) Michael Xavier 2012
MaintainerMichael Xavier <>
Safe HaskellSafe-Inferred



Attoparsec parser combinator for cron schedules. See cron documentation for how those are formatted.

import Data.Attoparsec.Text (parseOnly)
import System.Cron.Parser

main :: IO ()
main = do
  print $ parseOnly cronSchedule "*/2 * 3 * 4,5,6"



cronSchedule :: Parser CronSchedule Source

Attoparsec Parser for a cron schedule. Complies fully with the standard cron format. Also includes the following shorthand formats which cron also supports: @yearly, @monthly, @weekly, @daily, @hourly. Note that this parser will fail if there is extraneous input. This is to prevent things like extra fields. If you want a more lax parser, use cronScheduleLoose, which is fine with extra input.

cronScheduleLoose :: Parser CronSchedule Source

Same as cronSchedule but does not fail on extraneous input.

crontab :: Parser Crontab Source

Parses a full crontab file, omitting comments and including environment variable sets (e.g FOO=BAR).

crontabEntry :: Parser CrontabEntry Source

Parses an individual crontab line, which is either a scheduled command or an environmental variable set.