{-# LANGUAGE FlexibleContexts #-}
module Data.HodaTime.Pattern.CalendarDateTime
(
  -- * Standard Patterns
   ps
  ,pf
  ,pF
  ,pg
  ,pG
  -- * Custom Patterns
  --
  -- | Use combination of `Data.HodaTime.Pattern.CalendarDate` and `Data.HodaTime.Pattern.LocalTime` patterns
)
where

import Data.HodaTime.Pattern.Internal
import Data.HodaTime.CalendarDateTime.Internal (HasDate, Month, IsCalendar)
import Data.HodaTime.LocalTime.Internal (HasLocalTime)
import Data.HodaTime.Pattern.LocalTime
import Data.HodaTime.Pattern.CalendarDate

-- d1 = maybe (error "duh") id $ on <$> localTime 1 2 3 0 <*> calendarDate 1 January 2000
-- d2 = maybe (error "duh") id $ on <$> localTime 1 2 3 0 <*> calendarDate 3 March 2020
-- format ps d1
-- format ps d2
-- parse ps "2000/March/01" :: IO (CalendarDate Gregorian)

-- | The sortable pattern, which is always "yyyy'-'MM'-'dd'T'HH':'mm':'ss". (Note: this is only truly sortable for years within the range [0-9999].)
ps :: (HasLocalTime dt, HasDate dt) => Pattern (dt -> dt) (dt -> String) String
ps :: forall dt.
(HasLocalTime dt, HasDate dt) =>
Pattern (dt -> dt) (dt -> String) String
ps = Pattern (dt -> dt) (dt -> String) String
forall d. HasDate d => Pattern (d -> d) (d -> String) String
pyyyy Pattern (dt -> dt) (dt -> String) String
-> Pattern Char String String
-> Pattern (dt -> dt) (dt -> String) String
forall a b r c. Pattern a b r -> Pattern c r r -> Pattern a b r
<% Char -> Pattern Char String String
char Char
'-' Pattern (dt -> dt) (dt -> String) String
-> Pattern (dt -> dt) (dt -> String) String
-> Pattern (dt -> dt) (dt -> String) String
forall a. Semigroup a => a -> a -> a
<> Pattern (dt -> dt) (dt -> String) String
forall d. HasDate d => Pattern (d -> d) (d -> String) String
pMM Pattern (dt -> dt) (dt -> String) String
-> Pattern Char String String
-> Pattern (dt -> dt) (dt -> String) String
forall a b r c. Pattern a b r -> Pattern c r r -> Pattern a b r
<% Char -> Pattern Char String String
char Char
'-' Pattern (dt -> dt) (dt -> String) String
-> Pattern (dt -> dt) (dt -> String) String
-> Pattern (dt -> dt) (dt -> String) String
forall a. Semigroup a => a -> a -> a
<> Pattern (dt -> dt) (dt -> String) String
forall d. HasDate d => Pattern (d -> d) (d -> String) String
pdd Pattern (dt -> dt) (dt -> String) String
-> Pattern Char String String
-> Pattern (dt -> dt) (dt -> String) String
forall a b r c. Pattern a b r -> Pattern c r r -> Pattern a b r
<% Char -> Pattern Char String String
char Char
'T' Pattern (dt -> dt) (dt -> String) String
-> Pattern (dt -> dt) (dt -> String) String
-> Pattern (dt -> dt) (dt -> String) String
forall a. Semigroup a => a -> a -> a
<> Pattern (dt -> dt) (dt -> String) String
forall lt.
HasLocalTime lt =>
Pattern (lt -> lt) (lt -> String) String
pHH Pattern (dt -> dt) (dt -> String) String
-> Pattern Char String String
-> Pattern (dt -> dt) (dt -> String) String
forall a b r c. Pattern a b r -> Pattern c r r -> Pattern a b r
<% Char -> Pattern Char String String
char Char
':' Pattern (dt -> dt) (dt -> String) String
-> Pattern (dt -> dt) (dt -> String) String
-> Pattern (dt -> dt) (dt -> String) String
forall a. Semigroup a => a -> a -> a
<> Pattern (dt -> dt) (dt -> String) String
forall lt.
HasLocalTime lt =>
Pattern (lt -> lt) (lt -> String) String
pmm Pattern (dt -> dt) (dt -> String) String
-> Pattern Char String String
-> Pattern (dt -> dt) (dt -> String) String
forall a b r c. Pattern a b r -> Pattern c r r -> Pattern a b r
<% Char -> Pattern Char String String
char Char
':' Pattern (dt -> dt) (dt -> String) String
-> Pattern (dt -> dt) (dt -> String) String
-> Pattern (dt -> dt) (dt -> String) String
forall a. Semigroup a => a -> a -> a
<> Pattern (dt -> dt) (dt -> String) String
forall lt.
HasLocalTime lt =>
Pattern (lt -> lt) (lt -> String) String
pss

-- | The long date pattern followed by a space, followed by the short time pattern.
pf :: (HasLocalTime (c cal), HasDate (c cal), IsCalendar cal, Bounded (Month cal), Read (Month cal), Show (Month cal), Enum (Month cal)) => Pattern (c cal -> c cal) (c cal -> String) String
pf :: forall (c :: * -> *) cal.
(HasLocalTime (c cal), HasDate (c cal), IsCalendar cal,
 Bounded (Month cal), Read (Month cal), Show (Month cal),
 Enum (Month cal)) =>
Pattern (c cal -> c cal) (c cal -> String) String
pf = Pattern (c cal -> c cal) (c cal -> String) String
forall (c :: * -> *) cal.
(HasDate (c cal), IsCalendar cal, Bounded (Month cal),
 Read (Month cal), Show (Month cal), Enum (Month cal)) =>
Pattern (c cal -> c cal) (c cal -> String) String
pD Pattern (c cal -> c cal) (c cal -> String) String
-> Pattern Char String String
-> Pattern (c cal -> c cal) (c cal -> String) String
forall a b r c. Pattern a b r -> Pattern c r r -> Pattern a b r
<% Char -> Pattern Char String String
char Char
' ' Pattern (c cal -> c cal) (c cal -> String) String
-> Pattern (c cal -> c cal) (c cal -> String) String
-> Pattern (c cal -> c cal) (c cal -> String) String
forall a. Semigroup a => a -> a -> a
<> Pattern (c cal -> c cal) (c cal -> String) String
forall lt.
HasLocalTime lt =>
Pattern (lt -> lt) (lt -> String) String
pt

-- | The full date and time pattern. This is currently "dddd, dd MMMM yyyy HH:mm:ss".
pF :: (HasLocalTime (c cal), HasDate (c cal), IsCalendar cal, Bounded (Month cal), Read (Month cal), Show (Month cal), Enum (Month cal)) => Pattern (c cal -> c cal) (c cal -> String) String
pF :: forall (c :: * -> *) cal.
(HasLocalTime (c cal), HasDate (c cal), IsCalendar cal,
 Bounded (Month cal), Read (Month cal), Show (Month cal),
 Enum (Month cal)) =>
Pattern (c cal -> c cal) (c cal -> String) String
pF = Pattern (c cal -> c cal) (c cal -> String) String
forall (c :: * -> *) cal.
(HasDate (c cal), IsCalendar cal, Bounded (Month cal),
 Read (Month cal), Show (Month cal), Enum (Month cal)) =>
Pattern (c cal -> c cal) (c cal -> String) String
pD Pattern (c cal -> c cal) (c cal -> String) String
-> Pattern Char String String
-> Pattern (c cal -> c cal) (c cal -> String) String
forall a b r c. Pattern a b r -> Pattern c r r -> Pattern a b r
<% Char -> Pattern Char String String
char Char
' ' Pattern (c cal -> c cal) (c cal -> String) String
-> Pattern (c cal -> c cal) (c cal -> String) String
-> Pattern (c cal -> c cal) (c cal -> String) String
forall a. Semigroup a => a -> a -> a
<> Pattern (c cal -> c cal) (c cal -> String) String
forall lt.
HasLocalTime lt =>
Pattern (lt -> lt) (lt -> String) String
pT

-- | The short date pattern followed by a space, followed by the short time pattern.
pg :: (HasLocalTime dt, HasDate dt) => Pattern (dt -> dt) (dt -> String) String
pg :: forall dt.
(HasLocalTime dt, HasDate dt) =>
Pattern (dt -> dt) (dt -> String) String
pg = Pattern (dt -> dt) (dt -> String) String
forall d. HasDate d => Pattern (d -> d) (d -> String) String
pd Pattern (dt -> dt) (dt -> String) String
-> Pattern Char String String
-> Pattern (dt -> dt) (dt -> String) String
forall a b r c. Pattern a b r -> Pattern c r r -> Pattern a b r
<% Char -> Pattern Char String String
char Char
' ' Pattern (dt -> dt) (dt -> String) String
-> Pattern (dt -> dt) (dt -> String) String
-> Pattern (dt -> dt) (dt -> String) String
forall a. Semigroup a => a -> a -> a
<> Pattern (dt -> dt) (dt -> String) String
forall lt.
HasLocalTime lt =>
Pattern (lt -> lt) (lt -> String) String
pt

-- | The short date pattern followed by a space, followed by the long time pattern.
pG :: (HasLocalTime dt, HasDate dt) => Pattern (dt -> dt) (dt -> String) String
pG :: forall dt.
(HasLocalTime dt, HasDate dt) =>
Pattern (dt -> dt) (dt -> String) String
pG = Pattern (dt -> dt) (dt -> String) String
forall d. HasDate d => Pattern (d -> d) (d -> String) String
pd Pattern (dt -> dt) (dt -> String) String
-> Pattern Char String String
-> Pattern (dt -> dt) (dt -> String) String
forall a b r c. Pattern a b r -> Pattern c r r -> Pattern a b r
<% Char -> Pattern Char String String
char Char
' ' Pattern (dt -> dt) (dt -> String) String
-> Pattern (dt -> dt) (dt -> String) String
-> Pattern (dt -> dt) (dt -> String) String
forall a. Semigroup a => a -> a -> a
<> Pattern (dt -> dt) (dt -> String) String
forall lt.
HasLocalTime lt =>
Pattern (lt -> lt) (lt -> String) String
pT