{-# OPTIONS_GHC -fno-warn-orphans #-}

module Data.Time.LocalTime.Instances
  (
  ) where

import ClassyPrelude

import Data.Time.LocalTime

import Data.Binary (Binary)

import qualified Language.Haskell.TH.Syntax as TH

import qualified Data.Csv as Csv

import Data.Time.Clock.Instances
  ( iso8601OutputFormat, iso8601ParseFormat
  )


deriving instance Generic TimeOfDay
deriving instance Typeable TimeOfDay

instance Hashable TimeOfDay
instance Binary TimeOfDay


deriving instance TH.Lift TimeZone

instance Csv.ToField ZonedTime where
  toField = Csv.toField . formatTime defaultTimeLocale iso8601OutputFormat

instance Csv.FromField ZonedTime where
  parseField = parseTimeM False defaultTimeLocale iso8601ParseFormat <=< Csv.parseField
