-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A faster time library -- -- A faster time library @package thyme @version 0.2.1.0 -- | Julian or Gregorian. module Data.Thyme.Calendar.MonthDay type Month = Int type DayOfMonth = Int data MonthDay MonthDay :: {-# UNPACK #-} !Month -> {-# UNPACK #-} !DayOfMonth -> MonthDay mdMonth :: MonthDay -> {-# UNPACK #-} !Month mdDay :: MonthDay -> {-# UNPACK #-} !DayOfMonth -- | Convert between day of year in the Gregorian or Julian calendars, and -- month and day of month. First arg is leap year flag. monthDay :: Bool -> Simple Iso DayOfYear MonthDay monthDayValid :: Bool -> MonthDay -> Maybe DayOfYear monthLength :: Bool -> Month -> Days _mdMonth :: Lens' MonthDay Month _mdDay :: Lens' MonthDay DayOfMonth instance Typeable MonthDay instance Eq MonthDay instance Ord MonthDay instance Data MonthDay instance Show MonthDay instance NFData MonthDay -- | ISO 8601 Ordinal Date format module Data.Thyme.Calendar.OrdinalDate type Year = Int -- | Gregorian leap year? isLeapYear :: Year -> Bool type DayOfYear = Int data OrdinalDate OrdinalDate :: {-# UNPACK #-} !Year -> {-# UNPACK #-} !DayOfYear -> OrdinalDate odYear :: OrdinalDate -> {-# UNPACK #-} !Year odDay :: OrdinalDate -> {-# UNPACK #-} !DayOfYear ordinalDate :: Simple Iso Day OrdinalDate ordinalDateValid :: OrdinalDate -> Maybe Day _odYear :: Lens' OrdinalDate Year _odDay :: Lens' OrdinalDate DayOfYear -- | Various Week Date formats module Data.Thyme.Calendar.WeekDate type Year = Int type WeekOfYear = Int type DayOfWeek = Int -- | Weeks numbered 01 to 53, where week 01 is the first week that has at -- least 4 days in the new year. Days before week 01 are considered to -- belong to the previous year. data WeekDate WeekDate :: {-# UNPACK #-} !Year -> {-# UNPACK #-} !WeekOfYear -> {-# UNPACK #-} !DayOfWeek -> WeekDate wdYear :: WeekDate -> {-# UNPACK #-} !Year wdWeek :: WeekDate -> {-# UNPACK #-} !WeekOfYear wdDay :: WeekDate -> {-# UNPACK #-} !DayOfWeek weekDate :: Simple Iso Day WeekDate weekDateValid :: WeekDate -> Maybe Day showWeekDate :: Day -> String -- | Weeks numbered from 0 to 53, starting with the first Sunday of the -- year as the first day of week 1. The last week of a given year and -- week 0 of the next both refer to the same week, but not all -- DayOfWeek are valid. Year coincides with that of -- gregorian. data SundayWeek SundayWeek :: {-# UNPACK #-} !Year -> {-# UNPACK #-} !WeekOfYear -> {-# UNPACK #-} !DayOfWeek -> SundayWeek swYear :: SundayWeek -> {-# UNPACK #-} !Year swWeek :: SundayWeek -> {-# UNPACK #-} !WeekOfYear swDay :: SundayWeek -> {-# UNPACK #-} !DayOfWeek sundayWeek :: Simple Iso Day SundayWeek sundayWeekValid :: SundayWeek -> Maybe Day -- | Weeks numbered from 0 to 53, starting with the first Monday of the -- year as the first day of week 1. The last week of a given year and -- week 0 of the next both refer to the same week, but not all -- DayOfWeek are valid. Year coincides with that of -- gregorian. data MondayWeek MondayWeek :: {-# UNPACK #-} !Year -> {-# UNPACK #-} !WeekOfYear -> {-# UNPACK #-} !DayOfWeek -> MondayWeek mwYear :: MondayWeek -> {-# UNPACK #-} !Year mwWeek :: MondayWeek -> {-# UNPACK #-} !WeekOfYear mwDay :: MondayWeek -> {-# UNPACK #-} !DayOfWeek mondayWeek :: Simple Iso Day MondayWeek mondayWeekValid :: MondayWeek -> Maybe Day _wdYear :: Lens' WeekDate Year _wdWeek :: Lens' WeekDate WeekOfYear _wdDay :: Lens' WeekDate DayOfWeek _swYear :: Lens' SundayWeek Year _swWeek :: Lens' SundayWeek WeekOfYear _swDay :: Lens' SundayWeek DayOfWeek _mwYear :: Lens' MondayWeek Year _mwWeek :: Lens' MondayWeek WeekOfYear _mwDay :: Lens' MondayWeek DayOfWeek module Data.Thyme.Calendar type Years = Int type Months = Int type Days = Int -- | The Modified Julian Day is a standard count of days, with zero being -- the day 1858-11-17. newtype Day ModifiedJulianDay :: Int64 -> Day toModifiedJulianDay :: Day -> Int64 type Year = Int type Month = Int type DayOfMonth = Int data YearMonthDay YearMonthDay :: {-# UNPACK #-} !Year -> {-# UNPACK #-} !Month -> {-# UNPACK #-} !DayOfMonth -> YearMonthDay ymdYear :: YearMonthDay -> {-# UNPACK #-} !Year ymdMonth :: YearMonthDay -> {-# UNPACK #-} !Month ymdDay :: YearMonthDay -> {-# UNPACK #-} !DayOfMonth -- | Gregorian leap year? isLeapYear :: Year -> Bool yearMonthDay :: Simple Iso OrdinalDate YearMonthDay gregorian :: Simple Iso Day YearMonthDay gregorianValid :: YearMonthDay -> Maybe Day showGregorian :: Day -> String gregorianMonthLength :: Year -> Month -> Days gregorianMonthsClip :: Months -> YearMonthDay -> YearMonthDay gregorianMonthsRollover :: Months -> YearMonthDay -> YearMonthDay gregorianYearsClip :: Years -> YearMonthDay -> YearMonthDay gregorianYearsRollover :: Years -> YearMonthDay -> YearMonthDay _toModifiedJulianDay :: Iso' Day Int64 _ymdYear :: Lens' YearMonthDay Year _ymdMonth :: Lens' YearMonthDay Month _ymdDay :: Lens' YearMonthDay DayOfMonth instance Show Day module Data.Thyme.Calendar.WeekdayOfMonth data WeekdayOfMonth WeekdayOfMonth :: {-# UNPACK #-} !Year -> {-# UNPACK #-} !Month -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !DayOfWeek -> WeekdayOfMonth womYear :: WeekdayOfMonth -> {-# UNPACK #-} !Year womMonth :: WeekdayOfMonth -> {-# UNPACK #-} !Month -- | ±1–5, negative means n-th last womNth :: WeekdayOfMonth -> {-# UNPACK #-} !Int womDayOfWeek :: WeekdayOfMonth -> {-# UNPACK #-} !DayOfWeek weekdayOfMonth :: Simple Iso Day WeekdayOfMonth weekdayOfMonthValid :: WeekdayOfMonth -> Maybe Day _womYear :: Lens' WeekdayOfMonth Year _womNth :: Lens' WeekdayOfMonth Int _womMonth :: Lens' WeekdayOfMonth Month _womDayOfWeek :: Lens' WeekdayOfMonth DayOfWeek instance Typeable WeekdayOfMonth instance Eq WeekdayOfMonth instance Ord WeekdayOfMonth instance Data WeekdayOfMonth instance Show WeekdayOfMonth instance NFData WeekdayOfMonth module Data.Thyme.Clock.POSIX posixDayLength :: NominalDiffTime type POSIXTime = NominalDiffTime posixTime :: Simple Iso UTCTime POSIXTime getPOSIXTime :: IO POSIXTime module Data.Thyme.Clock data UniversalTime modJulianDate :: Simple Iso UniversalTime Rational data DiffTime microsecondsToDiffTime :: Int64 -> DiffTime data UTCTime data UTCView UTCTime :: {-# UNPACK #-} !Day -> {-# UNPACK #-} !DiffTime -> UTCView utctDay :: UTCView -> {-# UNPACK #-} !Day utctDayTime :: UTCView -> {-# UNPACK #-} !DiffTime utcTime :: Simple Iso UTCTime UTCView data NominalDiffTime microsecondsToNominalDiffTime :: Int64 -> NominalDiffTime getCurrentTime :: IO UTCTime _utctDay :: Simple Lens UTCTime Day _utctDayTime :: Simple Lens UTCTime DiffTime instance Show UTCTime module Data.Thyme.LocalTime -- | A TimeZone is a whole number of minutes offset from UTC, together with -- a name and a "just for summer" flag. data TimeZone :: * TimeZone :: Int -> Bool -> String -> TimeZone -- | The number of minutes offset from UTC. Positive means local time will -- be later in the day than UTC. timeZoneMinutes :: TimeZone -> Int -- | Is this time zone just persisting for the summer? timeZoneSummerOnly :: TimeZone -> Bool -- | The name of the zone, typically a three- or four-letter acronym. timeZoneName :: TimeZone -> String -- | Text representing the offset of this timezone, such as "-0800" or -- "+0400" (like %z in formatTime) timeZoneOffsetString :: TimeZone -> String -- | Text representing the offset of this timezone, such as "-0800" or -- "+0400" (like %z in formatTime), with arbitrary padding timeZoneOffsetString' :: NumericPadOption -> TimeZone -> String -- | Create a nameless non-summer timezone for this number of minutes minutesToTimeZone :: Int -> TimeZone -- | Create a nameless non-summer timezone for this number of hours hoursToTimeZone :: Int -> TimeZone -- | The UTC time zone utc :: TimeZone -- | Get the current time-zone getCurrentTimeZone :: IO TimeZone getTimeZone :: UTCTime -> IO TimeZone type Hour = Int type Minute = Int data TimeOfDay TimeOfDay :: {-# UNPACK #-} !Hour -> {-# UNPACK #-} !Minute -> {-# UNPACK #-} !DiffTime -> TimeOfDay todHour :: TimeOfDay -> {-# UNPACK #-} !Hour todMin :: TimeOfDay -> {-# UNPACK #-} !Minute todSec :: TimeOfDay -> {-# UNPACK #-} !DiffTime -- | Hour zero midnight :: TimeOfDay -- | Hour twelve midday :: TimeOfDay makeTimeOfDayValid :: Hour -> Minute -> DiffTime -> Maybe TimeOfDay timeOfDay :: Simple Iso DiffTime TimeOfDay type Minutes = Int -- | Add some minutes to a TimeOfDay; result comes with a day -- adjustment. addMinutes :: Minutes -> TimeOfDay -> (Days, TimeOfDay) dayFraction :: Simple Iso TimeOfDay Rational data LocalTime LocalTime :: {-# UNPACK #-} !Day -> {-# UNPACK #-} !TimeOfDay -> LocalTime localDay :: LocalTime -> {-# UNPACK #-} !Day localTimeOfDay :: LocalTime -> {-# UNPACK #-} !TimeOfDay utcLocalTime :: TimeZone -> Simple Iso UTCTime LocalTime ut1LocalTime :: Rational -> Simple Iso UniversalTime LocalTime data ZonedTime ZonedTime :: {-# UNPACK #-} !LocalTime -> !TimeZone -> ZonedTime zonedTimeToLocalTime :: ZonedTime -> {-# UNPACK #-} !LocalTime zonedTimeZone :: ZonedTime -> !TimeZone zonedTime :: Simple Iso (TimeZone, UTCTime) ZonedTime getZonedTime :: IO ZonedTime utcToLocalZonedTime :: UTCTime -> IO ZonedTime _timeZoneSummerOnly :: Lens' TimeZone Bool _timeZoneName :: Lens' TimeZone String _timeZoneMinutes :: Lens' TimeZone Int _todSec :: Lens' TimeOfDay DiffTime _todMin :: Lens' TimeOfDay Minute _todHour :: Lens' TimeOfDay Hour _localTimeOfDay :: Lens' LocalTime TimeOfDay _localDay :: Lens' LocalTime Day _zonedTimeZone :: Lens' ZonedTime TimeZone _zonedTimeToLocalTime :: Lens' ZonedTime LocalTime module Data.Thyme.Clock.TAI data AbsoluteTime -- | The epoch of TAI, which is 1858-11-17 00:00:00 TAI. taiEpoch :: AbsoluteTime type LeapSecondTable = Either UTCTime AbsoluteTime -> DiffTime utcDayLength :: LeapSecondTable -> Day -> DiffTime absoluteTime :: LeapSecondTable -> Simple Iso UTCTime AbsoluteTime -- | tai-utc.dat from -- http://maia.usno.navy.mil/ser7/tai-utc.dat parseTAIUTCDAT :: ByteString -> LeapSecondTable instance Typeable AbsoluteTime instance Eq AbsoluteTime instance Ord AbsoluteTime instance Enum AbsoluteTime instance Ix AbsoluteTime instance Bounded AbsoluteTime instance NFData AbsoluteTime instance Data AbsoluteTime instance AdditiveGroup AbsoluteTime instance AffineSpace AbsoluteTime instance Show AbsoluteTime module Data.Thyme.Format class FormatTime t showsTime :: FormatTime t => TimeLocale -> t -> (Char -> ShowS) -> Char -> ShowS formatTime :: FormatTime t => TimeLocale -> String -> t -> String class ParseTime t buildTime :: ParseTime t => TimeParse -> t parseTime :: ParseTime t => TimeLocale -> String -> String -> Maybe t readTime :: ParseTime t => TimeLocale -> String -> String -> t data TimeParse TimeParse :: {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Month -> {-# UNPACK #-} !WeekOfYear -> {-# UNPACK #-} !DayOfMonth -> {-# UNPACK #-} !DayOfYear -> {-# UNPACK #-} !DayOfWeek -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Hour -> {-# UNPACK #-} !Minute -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !DiffTime -> {-# UNPACK #-} !POSIXTime -> !TimeZone -> TimeParse tpCentury :: TimeParse -> {-# UNPACK #-} !Int tpCenturyYear :: TimeParse -> {-# UNPACK #-} !Int tpMonth :: TimeParse -> {-# UNPACK #-} !Month tpWeekOfYear :: TimeParse -> {-# UNPACK #-} !WeekOfYear tpDayOfMonth :: TimeParse -> {-# UNPACK #-} !DayOfMonth tpDayOfYear :: TimeParse -> {-# UNPACK #-} !DayOfYear tpDayOfWeek :: TimeParse -> {-# UNPACK #-} !DayOfWeek tpFlags :: TimeParse -> {-# UNPACK #-} !Int tpHour :: TimeParse -> {-# UNPACK #-} !Hour tpMinute :: TimeParse -> {-# UNPACK #-} !Minute tpSecond :: TimeParse -> {-# UNPACK #-} !Int tpSecFrac :: TimeParse -> {-# UNPACK #-} !DiffTime tpPOSIXTime :: TimeParse -> {-# UNPACK #-} !POSIXTime tpTimeZone :: TimeParse -> !TimeZone -- | Time Parser for UTF-8 encoded ByteStrings. -- -- Attoparsec easily beats any String parser out there, but we do -- have to be careful to convert the input to UTF-8 ByteStrings. timeParser :: TimeLocale -> String -> Parser TimeParse instance ParseTime AbsoluteTime instance ParseTime UniversalTime instance ParseTime UTCTime instance ParseTime ZonedTime instance ParseTime TimeZone instance ParseTime Day instance ParseTime LocalTime instance ParseTime MondayWeek instance ParseTime SundayWeek instance ParseTime WeekDate instance ParseTime OrdinalDate instance ParseTime MonthDay instance ParseTime YearMonthDay instance ParseTime TimeOfDay instance Enum TimeFlag instance Show TimeFlag instance Show TimeParse instance FormatTime AbsoluteTime instance FormatTime UniversalTime instance FormatTime UTCTime instance FormatTime ZonedTime instance FormatTime TimeZone instance FormatTime Day instance FormatTime LocalTime instance FormatTime MondayWeek instance FormatTime SundayWeek instance FormatTime WeekDate instance FormatTime OrdinalDate instance FormatTime MonthDay instance FormatTime YearMonthDay instance FormatTime TimeOfDay -- | Compatibility between thyme and time. module Data.Thyme.Time class Thyme a b thyme :: Thyme a b => Simple Iso a b addDays :: Days -> Day -> Day diffDays :: Day -> Day -> Days toGregorian :: Day -> (Year, Month, DayOfMonth) fromGregorian :: Year -> Month -> DayOfMonth -> Day fromGregorianValid :: Year -> Month -> DayOfMonth -> Maybe Day addGregorianMonthsClip :: Months -> Day -> Day addGregorianMonthsRollover :: Months -> Day -> Day addGregorianYearsClip :: Years -> Day -> Day addGregorianYearsRollover :: Years -> Day -> Day dayOfYearToMonthAndDay :: Bool -> DayOfYear -> (Month, DayOfMonth) monthAndDayToDayOfYear :: Bool -> Month -> DayOfMonth -> DayOfYear monthAndDayToDayOfYearValid :: Bool -> Month -> DayOfMonth -> Maybe DayOfYear toOrdinalDate :: Day -> (Year, DayOfYear) fromOrdinalDate :: Year -> DayOfYear -> Day fromOrdinalDateValid :: Year -> DayOfYear -> Maybe Day sundayStartWeek :: Day -> (Year, WeekOfYear, DayOfWeek) fromSundayStartWeek :: Year -> WeekOfYear -> DayOfWeek -> Day fromSundayStartWeekValid :: Year -> WeekOfYear -> DayOfWeek -> Maybe Day mondayStartWeek :: Day -> (Year, WeekOfYear, DayOfWeek) fromMondayStartWeek :: Year -> WeekOfYear -> DayOfWeek -> Day fromMondayStartWeekValid :: Year -> WeekOfYear -> DayOfWeek -> Maybe Day toWeekDate :: Day -> (Year, WeekOfYear, DayOfWeek) fromWeekDate :: Year -> WeekOfYear -> DayOfWeek -> Day fromWeekDateValid :: Year -> WeekOfYear -> DayOfWeek -> Maybe Day secondsToDiffTime :: Int64 -> DiffTime picosecondsToDiffTime :: Int64 -> DiffTime addUTCTime :: NominalDiffTime -> UTCTime -> UTCTime diffUTCTime :: UTCTime -> UTCTime -> NominalDiffTime posixSecondsToUTCTime :: POSIXTime -> UTCTime utcTimeToPOSIXSeconds :: UTCTime -> POSIXTime addAbsoluteTime :: DiffTime -> AbsoluteTime -> AbsoluteTime diffAbsoluteTime :: AbsoluteTime -> AbsoluteTime -> DiffTime utcToTAITime :: LeapSecondTable -> UTCTime -> AbsoluteTime taiToUTCTime :: LeapSecondTable -> AbsoluteTime -> UTCTime utcToLocalTimeOfDay :: TimeZone -> TimeOfDay -> (Days, TimeOfDay) localToUTCTimeOfDay :: TimeZone -> TimeOfDay -> (Days, TimeOfDay) timeToTimeOfDay :: DiffTime -> TimeOfDay timeOfDayToTime :: TimeOfDay -> DiffTime dayFractionToTimeOfDay :: Rational -> TimeOfDay timeOfDayToDayFraction :: TimeOfDay -> Rational utcToLocalTime :: TimeZone -> UTCTime -> LocalTime localTimeToUTC :: TimeZone -> LocalTime -> UTCTime ut1ToLocalTime :: Rational -> UniversalTime -> LocalTime localTimeToUT1 :: Rational -> LocalTime -> UniversalTime utcToZonedTime :: TimeZone -> UTCTime -> ZonedTime zonedTimeToUTC :: ZonedTime -> UTCTime instance Thyme ZonedTime ZonedTime instance Thyme LocalTime LocalTime instance Thyme TimeOfDay TimeOfDay instance Thyme TimeZone TimeZone instance Thyme AbsoluteTime AbsoluteTime instance Thyme NominalDiffTime NominalDiffTime instance Thyme UTCTime UTCTime instance Thyme UTCTime UTCView instance Thyme DiffTime DiffTime instance Thyme UniversalTime UniversalTime instance Thyme Day Day module Data.Thyme