Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/haskell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: CI
on:
push:
branches:
- master
pull_request:
types:
- opened
- synchronize
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest]
cabal: ["3.8"]
ghc: ["8.4.4", "8.6.5", "8.8.4", "8.10.7", "9.0.2", "9.2.6", "9.4.4"]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3
- uses: haskell/actions/setup@v2
id: setup-haskell-cabal
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
- name: Cabal Update
run: |
cabal v2-update
cabal v2-freeze $CONFIG
- uses: actions/cache@v2.1.5
with:
path: |
${{ steps.setup-haskell-cabal.outputs.cabal-store }}
dist-newstyle
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
restore-keys: |
${{ runner.os }}-${{ matrix.ghc }}-${{ matrix.cabal }}-
- name: Build all
run: |
cabal build all
cabal sdist all
- name: Run tests
run: |
cabal test all
- name: Build haddock
run: |
cabal haddock all
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/dist/
/dist-newstyle/
94 changes: 0 additions & 94 deletions .travis.yml

This file was deleted.

7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## unreleased

## 0.4

* Supported GHC 9 and older
* Changed the type of `mkUTCTime :: Day -> DiffTime -> UTCTime` to `mkUTCTime :: Year -> Month -> DayOfMonth -> Hour -> Minute -> Double -> UTCTime`. Use the `UTCTime` pattern synonym instead if needed.
* Miscellaneous API additions and refactors
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# thyme

[![Status](https://travis-ci.org/liyang/thyme.png)][travis] [Hackage][]
[![CI](https://github.com/fumieval/thyme/actions/workflows/haskell.yml/badge.svg)](https://github.com/fumieval/thyme/actions/workflows/haskell.yml) [![Hackage](https://img.shields.io/hackage/v/thyme.svg?logo=haskell)](http://hackage.haskell.org/package/thyme)

A faster date and time library based on [time][].

Expand All @@ -14,19 +14,17 @@ A faster date and time library based on [time][].
### Library

```
stack build --flag thyme:lens
cabal build
```

### Haddock

```
stack haddock --flag thyme:lens
cabal haddock
```

[Hackage]: http://hackage.haskell.org/package/thyme
[Iso']: http://hackage.haskell.org/package/lens/docs/Control-Lens-Iso.html#t:Iso-39-
[Lens']: http://hackage.haskell.org/package/lens/docs/Control-Lens-Lens.html#t:Lens-39-
[lens]: http://hackage.haskell.org/package/lens
[time]: http://hackage.haskell.org/package/time
[travis]: https://travis-ci.org/liyang/thyme

4 changes: 2 additions & 2 deletions src/Data/Thyme/Clock/TAI.hs
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ diffAbsoluteTime = (.-.)
-- @
{-# INLINE utcToTAITime #-}
utcToTAITime :: TAIUTCMap -> UTCTime -> AbsoluteTime
utcToTAITime = view . absoluteTime
utcToTAITime m = view (absoluteTime m)

-- | Using a 'TAIUTCMap', convert a 'AbsoluteTime' to 'UTCTime'.
--
Expand All @@ -353,5 +353,5 @@ utcToTAITime = view . absoluteTime
-- @
{-# INLINE taiToUTCTime #-}
taiToUTCTime :: TAIUTCMap -> AbsoluteTime -> UTCTime
taiToUTCTime = review . absoluteTime
taiToUTCTime m = review (absoluteTime m)

8 changes: 6 additions & 2 deletions src/Data/Thyme/Format.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE ViewPatterns #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
#if __GLASGOW_HASKELL__ >= 810
{-# OPTIONS_GHC -Wno-unused-record-wildcards #-}
#endif

#include "thyme.h"

-- | Formatting and parsing for dates and times.
Expand Down Expand Up @@ -284,7 +288,7 @@ showsY = showsYear

instance FormatTime TimeOfDay where
{-# INLINEABLE showsTime #-}
showsTime TimeLocale {..} (TimeOfDay h m (DiffTime s)) = \ def c -> case c of
showsTime TimeLocale{..} (TimeOfDay h m (DiffTime s)) = \ def c -> case c of
-- aggregate
'R' -> shows02 h . (:) ':' . shows02 m
'T' -> shows02 h . (:) ':' . shows02 m . (:) ':' . shows02 si
Expand Down Expand Up @@ -838,7 +842,7 @@ instance ParseTime LocalTime where

instance ParseTime Day where
{-# INLINE buildTime #-}
buildTime tp@TimeParse {..}
buildTime tp
| tp ^. flag IsOrdinalDate = ordinalDate # buildTime tp
| tp ^. flag IsGregorian = gregorian # buildTime tp
| tp ^. flag IsWeekDate = weekDate # buildTime tp
Expand Down
8 changes: 4 additions & 4 deletions src/Data/Thyme/LocalTime.hs
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ timeOfDayToDayFraction = view dayFraction
-- @
{-# INLINE utcToLocalTime #-}
utcToLocalTime :: TimeZone -> UTCTime -> LocalTime
utcToLocalTime = view . utcLocalTime
utcToLocalTime tz = view (utcLocalTime tz)

-- | Convert a 'LocalTime' in the given 'TimeZone' to a 'UTCTime'.
--
Expand All @@ -629,7 +629,7 @@ utcToLocalTime = view . utcLocalTime
-- @
{-# INLINE localTimeToUTC #-}
localTimeToUTC :: TimeZone -> LocalTime -> UTCTime
localTimeToUTC = review . utcLocalTime
localTimeToUTC tz = review (utcLocalTime tz)

-- | Convert a 'UniversalTime' to a 'LocalTime' at the given medidian in
-- degrees East.
Expand All @@ -639,7 +639,7 @@ localTimeToUTC = review . utcLocalTime
-- @
{-# INLINE ut1ToLocalTime #-}
ut1ToLocalTime :: Rational -> UniversalTime -> LocalTime
ut1ToLocalTime = view . ut1LocalTime
ut1ToLocalTime l = view (ut1LocalTime l)

-- | Convert a 'LocalTime' at the given meridian in degrees East to
-- a 'UniversalTime'.
Expand All @@ -649,7 +649,7 @@ ut1ToLocalTime = view . ut1LocalTime
-- @
{-# INLINE localTimeToUT1 #-}
localTimeToUT1 :: Rational -> LocalTime -> UniversalTime
localTimeToUT1 = review . ut1LocalTime
localTimeToUT1 l = review (ut1LocalTime l)

-- | Convert a 'UTCTime' and the given 'TimeZone' into a 'ZonedTime'.
--
Expand Down
2 changes: 1 addition & 1 deletion src/Data/Thyme/Time/Core.hs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import qualified Data.Time.Calendar as T
import qualified Data.Time.Clock as T
import qualified Data.Time.Clock.TAI as T
import qualified Data.Time.LocalTime as T
import Unsafe.TrueName
import Data.Thyme.TrueName

------------------------------------------------------------------------
-- * Type conversion
Expand Down
Loading