{-# LANGUAGE FlexibleContexts, FlexibleInstances , MultiParamTypeClasses, TemplateHaskell , TypeSynonymInstances, UndecidableInstances #-} module Editor4thRecurring where import Entry2ndRecurring import Graphics.UI.AF.WxFormAll $(derive [''Entry,''Time,''Month,''TimeDiff]) main = startWx "Editor4th" $ editFile specLocation ([]::HCron) instance TypePresentation (Entry Time) tp1 tp2 tp3 tp4 tp5 where mkCom x = limit timeLimit ("Incorrect time") (defaultCom x) where timeLimit :: Entry Time -> IO Bool timeLimit Entry { when = Time y month d h m } = return $ y > 1970 && y < 2100 && d >= 1 && ((month == February && d <= 28) || (month == February && d == 29 && y `mod` 4 == 0) || (month `elem` [ January, March, May, July, August , October, December] && d <= 30) || (month `elem` [April, June, September, November] && d <= 30) ) && h >= 0 && h <= 23 && m >= 0 && m <= 59 instance GInstanceCreator Time where gGenUpTo _ = [Time 2000 January 1 10 00]