-- Intermediate types used by the parser portion of the Pattern
module Data.HodaTime.Pattern.ParseTypes
(
   TimeInfo(..)
  ,hour
  ,minute
  ,second
  ,DateInfo(..)
  ,DateTimeInfo(..)
  ,ZonedDateTimeInfo(..)
)
where

import Data.HodaTime.CalendarDateTime.Internal (Month)

data TimeInfo = TimeInfo
  {
     TimeInfo -> Int
_hour :: Int
    ,TimeInfo -> Int
_minute :: Int
    ,TimeInfo -> Int
_second :: Int
    ,TimeInfo -> Int
_nanoSecond :: Int
  }

hour :: Functor f => (Int -> f Int) -> TimeInfo -> f TimeInfo
hour :: forall (f :: * -> *).
Functor f =>
(Int -> f Int) -> TimeInfo -> f TimeInfo
hour Int -> f Int
k TimeInfo
ti = (Int -> TimeInfo) -> f Int -> f TimeInfo
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\Int
h -> TimeInfo
ti { _hour = h }) (Int -> f Int
k (TimeInfo -> Int
_hour TimeInfo
ti))

minute :: Functor f => (Int -> f Int) -> TimeInfo -> f TimeInfo
minute :: forall (f :: * -> *).
Functor f =>
(Int -> f Int) -> TimeInfo -> f TimeInfo
minute Int -> f Int
k TimeInfo
ti = (Int -> TimeInfo) -> f Int -> f TimeInfo
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\Int
m -> TimeInfo
ti { _minute = m }) (Int -> f Int
k (TimeInfo -> Int
_minute TimeInfo
ti))

second :: Functor f => (Int -> f Int) -> TimeInfo -> f TimeInfo
second :: forall (f :: * -> *).
Functor f =>
(Int -> f Int) -> TimeInfo -> f TimeInfo
second Int -> f Int
k TimeInfo
ti = (Int -> TimeInfo) -> f Int -> f TimeInfo
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\Int
s -> TimeInfo
ti { _second = s }) (Int -> f Int
k (TimeInfo -> Int
_second TimeInfo
ti))

data DateInfo cal = DateInfo
  {
     forall cal. DateInfo cal -> Maybe Int
day :: Maybe Int
    ,forall cal. DateInfo cal -> Maybe (Month cal)
month :: Maybe (Month cal)
    ,forall cal. DateInfo cal -> Maybe Int
year :: Maybe Int
  }

data DateTimeInfo cal = DateTimeInfo
  {
     forall cal. DateTimeInfo cal -> DateInfo cal
date :: DateInfo cal
    ,forall cal. DateTimeInfo cal -> TimeInfo
time :: TimeInfo
  }

data ZonedDateTimeInfo cal = ZonedDateTimeInfo
  {
     forall cal. ZonedDateTimeInfo cal -> DateTimeInfo cal
dateTime :: DateTimeInfo cal
    ,forall cal. ZonedDateTimeInfo cal -> String
zone :: String
  }