Skip to content

Commit

Permalink
More
Browse files Browse the repository at this point in the history
  • Loading branch information
phadej committed Dec 23, 2024
1 parent fc08393 commit 3772724
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Data/Time/Calendar/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import Data.Time.Calendar.WeekDate (WeekOfYear)
#endif

#if MIN_VERSION_time(1,12,1)
import Data.Time.Calendar (CommonEra, BeforeCommonEra)
import Data.Time.Calendar (pattern CommonEra, pattern BeforeCommonEra)
#endif

#if !MIN_VERSION_time(1,11,0)
Expand Down
8 changes: 6 additions & 2 deletions src/Data/Time/Clock/Compat.hs
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,13 @@ nominalDiffTimeToSeconds = realToFrac
#if !MIN_VERSION_time(1,14,0)
instance TH.Lift DiffTime where
lift x = [| picosecondsToDiffTime $(TH.lift (diffTimeToPicoseconds x)) |]
liftTyped x = [|| picosecondsToDiffTime $$(TH.liftTyped (diffTimeToPicoseconds x)) ||]
liftTyped x = [|| picosecondsToDiffTime x' ||]
where
x' = diffTimeToPicoseconds x

instance TH.Lift NominalDiffTime where
lift x = [| secondsToNominalDiffTime (MkFixed $(TH.lift (case nominalDiffTimeToSeconds x of MkFixed y -> y))) |]
liftTyped x = [|| secondsToNominalDiffTime (MkFixed $$(TH.liftTyped (case nominalDiffTimeToSeconds x of MkFixed y -> y))) ||]
liftTyped x = [|| secondsToNominalDiffTime (MkFixed x') ||]
where
x' = case nominalDiffTimeToSeconds x of MkFixed y -> y
#endif
2 changes: 2 additions & 0 deletions test/main/Test/Format/Compile.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module Test.Format.Compile (

) where

{-
import Data.Time.Compat
newtype WrappedUTCTime
Expand All @@ -14,3 +15,4 @@ newtype WrappedUTCTime
newtype Wrapped t
= MkWrapped t
deriving (FormatTime, ParseTime)
-}

0 comments on commit 3772724

Please sign in to comment.