tztime 0.1.0.0 → 0.1.1.0
raw patch · 3 files changed
+51/−6 lines, 3 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Data.Time.TZInfo: Root__CET :: TZLabel
- Data.Time.TZInfo: Root__CST6CDT :: TZLabel
- Data.Time.TZInfo: Root__EET :: TZLabel
- Data.Time.TZInfo: Root__EST :: TZLabel
- Data.Time.TZInfo: Root__EST5EDT :: TZLabel
- Data.Time.TZInfo: Root__HST :: TZLabel
- Data.Time.TZInfo: Root__MET :: TZLabel
- Data.Time.TZInfo: Root__MST :: TZLabel
- Data.Time.TZInfo: Root__MST7MDT :: TZLabel
- Data.Time.TZInfo: Root__PST8PDT :: TZLabel
- Data.Time.TZInfo: Root__WET :: TZLabel
+ Data.Time.TZInfo: Africa__Accra :: TZLabel
+ Data.Time.TZInfo: Africa__Addis_Ababa :: TZLabel
+ Data.Time.TZInfo: Africa__Asmara :: TZLabel
+ Data.Time.TZInfo: Africa__Asmera :: TZLabel
+ Data.Time.TZInfo: Africa__Bamako :: TZLabel
+ Data.Time.TZInfo: Africa__Bangui :: TZLabel
+ Data.Time.TZInfo: Africa__Banjul :: TZLabel
+ Data.Time.TZInfo: Africa__Blantyre :: TZLabel
+ Data.Time.TZInfo: Africa__Brazzaville :: TZLabel
+ Data.Time.TZInfo: Africa__Bujumbura :: TZLabel
+ Data.Time.TZInfo: Africa__Conakry :: TZLabel
+ Data.Time.TZInfo: Africa__Dakar :: TZLabel
+ Data.Time.TZInfo: Africa__Dar_es_Salaam :: TZLabel
+ Data.Time.TZInfo: Africa__Djibouti :: TZLabel
+ Data.Time.TZInfo: Africa__Douala :: TZLabel
+ Data.Time.TZInfo: Africa__Freetown :: TZLabel
+ Data.Time.TZInfo: Africa__Gaborone :: TZLabel
+ Data.Time.TZInfo: Africa__Harare :: TZLabel
+ Data.Time.TZInfo: Africa__Kampala :: TZLabel
+ Data.Time.TZInfo: Africa__Kigali :: TZLabel
+ Data.Time.TZInfo: Africa__Kinshasa :: TZLabel
+ Data.Time.TZInfo: Africa__Libreville :: TZLabel
+ Data.Time.TZInfo: Africa__Lome :: TZLabel
+ Data.Time.TZInfo: Africa__Luanda :: TZLabel
+ Data.Time.TZInfo: Africa__Lubumbashi :: TZLabel
+ Data.Time.TZInfo: Africa__Lusaka :: TZLabel
+ Data.Time.TZInfo: Africa__Malabo :: TZLabel
+ Data.Time.TZInfo: Africa__Maseru :: TZLabel
+ Data.Time.TZInfo: Africa__Mbabane :: TZLabel
+ Data.Time.TZInfo: Africa__Mogadishu :: TZLabel
+ Data.Time.TZInfo: Africa__Niamey :: TZLabel
+ Data.Time.TZInfo: Africa__Nouakchott :: TZLabel
+ Data.Time.TZInfo: Africa__Ouagadougou :: TZLabel
+ Data.Time.TZInfo: Africa__Porto_Novo :: TZLabel
+ Data.Time.TZInfo: Africa__Timbuktu :: TZLabel
+ Data.Time.TZInfo: America__Anguilla :: TZLabel
+ Data.Time.TZInfo: America__Antigua :: TZLabel
+ Data.Time.TZInfo: America__Argentina__ComodRivadavia :: TZLabel
+ Data.Time.TZInfo: America__Aruba :: TZLabel
+ Data.Time.TZInfo: America__Atikokan :: TZLabel
+ Data.Time.TZInfo: America__Atka :: TZLabel
+ Data.Time.TZInfo: America__Blanc_Sablon :: TZLabel
+ Data.Time.TZInfo: America__Buenos_Aires :: TZLabel
+ Data.Time.TZInfo: America__Catamarca :: TZLabel
+ Data.Time.TZInfo: America__Cayman :: TZLabel
+ Data.Time.TZInfo: America__Ciudad_Juarez :: TZLabel
+ Data.Time.TZInfo: America__Coral_Harbour :: TZLabel
+ Data.Time.TZInfo: America__Cordoba :: TZLabel
+ Data.Time.TZInfo: America__Creston :: TZLabel
+ Data.Time.TZInfo: America__Curacao :: TZLabel
+ Data.Time.TZInfo: America__Dominica :: TZLabel
+ Data.Time.TZInfo: America__Ensenada :: TZLabel
+ Data.Time.TZInfo: America__Fort_Wayne :: TZLabel
+ Data.Time.TZInfo: America__Godthab :: TZLabel
+ Data.Time.TZInfo: America__Grenada :: TZLabel
+ Data.Time.TZInfo: America__Guadeloupe :: TZLabel
+ Data.Time.TZInfo: America__Indianapolis :: TZLabel
+ Data.Time.TZInfo: America__Jujuy :: TZLabel
+ Data.Time.TZInfo: America__Knox_IN :: TZLabel
+ Data.Time.TZInfo: America__Kralendijk :: TZLabel
+ Data.Time.TZInfo: America__Louisville :: TZLabel
+ Data.Time.TZInfo: America__Lower_Princes :: TZLabel
+ Data.Time.TZInfo: America__Marigot :: TZLabel
+ Data.Time.TZInfo: America__Mendoza :: TZLabel
+ Data.Time.TZInfo: America__Montreal :: TZLabel
+ Data.Time.TZInfo: America__Montserrat :: TZLabel
+ Data.Time.TZInfo: America__Nassau :: TZLabel
+ Data.Time.TZInfo: America__Port_of_Spain :: TZLabel
+ Data.Time.TZInfo: America__Porto_Acre :: TZLabel
+ Data.Time.TZInfo: America__Rosario :: TZLabel
+ Data.Time.TZInfo: America__Santa_Isabel :: TZLabel
+ Data.Time.TZInfo: America__Shiprock :: TZLabel
+ Data.Time.TZInfo: America__St_Barthelemy :: TZLabel
+ Data.Time.TZInfo: America__St_Kitts :: TZLabel
+ Data.Time.TZInfo: America__St_Lucia :: TZLabel
+ Data.Time.TZInfo: America__St_Thomas :: TZLabel
+ Data.Time.TZInfo: America__St_Vincent :: TZLabel
+ Data.Time.TZInfo: America__Tortola :: TZLabel
+ Data.Time.TZInfo: America__Virgin :: TZLabel
+ Data.Time.TZInfo: Antarctica__DumontDUrville :: TZLabel
+ Data.Time.TZInfo: Antarctica__McMurdo :: TZLabel
+ Data.Time.TZInfo: Antarctica__South_Pole :: TZLabel
+ Data.Time.TZInfo: Antarctica__Syowa :: TZLabel
+ Data.Time.TZInfo: Antarctica__Vostok :: TZLabel
+ Data.Time.TZInfo: Arctic__Longyearbyen :: TZLabel
+ Data.Time.TZInfo: Asia__Aden :: TZLabel
+ Data.Time.TZInfo: Asia__Ashkhabad :: TZLabel
+ Data.Time.TZInfo: Asia__Bahrain :: TZLabel
+ Data.Time.TZInfo: Asia__Brunei :: TZLabel
+ Data.Time.TZInfo: Asia__Calcutta :: TZLabel
+ Data.Time.TZInfo: Asia__Chongqing :: TZLabel
+ Data.Time.TZInfo: Asia__Chungking :: TZLabel
+ Data.Time.TZInfo: Asia__Dacca :: TZLabel
+ Data.Time.TZInfo: Asia__Harbin :: TZLabel
+ Data.Time.TZInfo: Asia__Istanbul :: TZLabel
+ Data.Time.TZInfo: Asia__Kashgar :: TZLabel
+ Data.Time.TZInfo: Asia__Katmandu :: TZLabel
+ Data.Time.TZInfo: Asia__Kuala_Lumpur :: TZLabel
+ Data.Time.TZInfo: Asia__Kuwait :: TZLabel
+ Data.Time.TZInfo: Asia__Macao :: TZLabel
+ Data.Time.TZInfo: Asia__Muscat :: TZLabel
+ Data.Time.TZInfo: Asia__Phnom_Penh :: TZLabel
+ Data.Time.TZInfo: Asia__Rangoon :: TZLabel
+ Data.Time.TZInfo: Asia__Saigon :: TZLabel
+ Data.Time.TZInfo: Asia__Tel_Aviv :: TZLabel
+ Data.Time.TZInfo: Asia__Thimbu :: TZLabel
+ Data.Time.TZInfo: Asia__Ujung_Pandang :: TZLabel
+ Data.Time.TZInfo: Asia__Ulan_Bator :: TZLabel
+ Data.Time.TZInfo: Asia__Vientiane :: TZLabel
+ Data.Time.TZInfo: Atlantic__Faeroe :: TZLabel
+ Data.Time.TZInfo: Atlantic__Jan_Mayen :: TZLabel
+ Data.Time.TZInfo: Atlantic__Reykjavik :: TZLabel
+ Data.Time.TZInfo: Atlantic__St_Helena :: TZLabel
+ Data.Time.TZInfo: Australia__ACT :: TZLabel
+ Data.Time.TZInfo: Australia__Canberra :: TZLabel
+ Data.Time.TZInfo: Australia__Currie :: TZLabel
+ Data.Time.TZInfo: Australia__LHI :: TZLabel
+ Data.Time.TZInfo: Australia__NSW :: TZLabel
+ Data.Time.TZInfo: Australia__North :: TZLabel
+ Data.Time.TZInfo: Australia__Queensland :: TZLabel
+ Data.Time.TZInfo: Australia__South :: TZLabel
+ Data.Time.TZInfo: Australia__Tasmania :: TZLabel
+ Data.Time.TZInfo: Australia__Victoria :: TZLabel
+ Data.Time.TZInfo: Australia__West :: TZLabel
+ Data.Time.TZInfo: Australia__Yancowinna :: TZLabel
+ Data.Time.TZInfo: Brazil__Acre :: TZLabel
+ Data.Time.TZInfo: Brazil__DeNoronha :: TZLabel
+ Data.Time.TZInfo: Brazil__East :: TZLabel
+ Data.Time.TZInfo: Brazil__West :: TZLabel
+ Data.Time.TZInfo: CET :: TZLabel
+ Data.Time.TZInfo: CST6CDT :: TZLabel
+ Data.Time.TZInfo: Canada__Atlantic :: TZLabel
+ Data.Time.TZInfo: Canada__Central :: TZLabel
+ Data.Time.TZInfo: Canada__Eastern :: TZLabel
+ Data.Time.TZInfo: Canada__Mountain :: TZLabel
+ Data.Time.TZInfo: Canada__Newfoundland :: TZLabel
+ Data.Time.TZInfo: Canada__Pacific :: TZLabel
+ Data.Time.TZInfo: Canada__Saskatchewan :: TZLabel
+ Data.Time.TZInfo: Canada__Yukon :: TZLabel
+ Data.Time.TZInfo: Chile__Continental :: TZLabel
+ Data.Time.TZInfo: Chile__EasterIsland :: TZLabel
+ Data.Time.TZInfo: Cuba :: TZLabel
+ Data.Time.TZInfo: EET :: TZLabel
+ Data.Time.TZInfo: EST :: TZLabel
+ Data.Time.TZInfo: EST5EDT :: TZLabel
+ Data.Time.TZInfo: Egypt :: TZLabel
+ Data.Time.TZInfo: Eire :: TZLabel
+ Data.Time.TZInfo: Etc__GMT'0 :: TZLabel
+ Data.Time.TZInfo: Etc__GMT0 :: TZLabel
+ Data.Time.TZInfo: Etc__GMT_0 :: TZLabel
+ Data.Time.TZInfo: Etc__Greenwich :: TZLabel
+ Data.Time.TZInfo: Etc__UCT :: TZLabel
+ Data.Time.TZInfo: Etc__Universal :: TZLabel
+ Data.Time.TZInfo: Etc__Zulu :: TZLabel
+ Data.Time.TZInfo: Europe__Amsterdam :: TZLabel
+ Data.Time.TZInfo: Europe__Belfast :: TZLabel
+ Data.Time.TZInfo: Europe__Bratislava :: TZLabel
+ Data.Time.TZInfo: Europe__Busingen :: TZLabel
+ Data.Time.TZInfo: Europe__Copenhagen :: TZLabel
+ Data.Time.TZInfo: Europe__Guernsey :: TZLabel
+ Data.Time.TZInfo: Europe__Isle_of_Man :: TZLabel
+ Data.Time.TZInfo: Europe__Jersey :: TZLabel
+ Data.Time.TZInfo: Europe__Kiev :: TZLabel
+ Data.Time.TZInfo: Europe__Ljubljana :: TZLabel
+ Data.Time.TZInfo: Europe__Luxembourg :: TZLabel
+ Data.Time.TZInfo: Europe__Mariehamn :: TZLabel
+ Data.Time.TZInfo: Europe__Monaco :: TZLabel
+ Data.Time.TZInfo: Europe__Nicosia :: TZLabel
+ Data.Time.TZInfo: Europe__Oslo :: TZLabel
+ Data.Time.TZInfo: Europe__Podgorica :: TZLabel
+ Data.Time.TZInfo: Europe__San_Marino :: TZLabel
+ Data.Time.TZInfo: Europe__Sarajevo :: TZLabel
+ Data.Time.TZInfo: Europe__Skopje :: TZLabel
+ Data.Time.TZInfo: Europe__Stockholm :: TZLabel
+ Data.Time.TZInfo: Europe__Tiraspol :: TZLabel
+ Data.Time.TZInfo: Europe__Vaduz :: TZLabel
+ Data.Time.TZInfo: Europe__Vatican :: TZLabel
+ Data.Time.TZInfo: Europe__Zagreb :: TZLabel
+ Data.Time.TZInfo: Factory :: TZLabel
+ Data.Time.TZInfo: GB :: TZLabel
+ Data.Time.TZInfo: GB_Eire :: TZLabel
+ Data.Time.TZInfo: GMT :: TZLabel
+ Data.Time.TZInfo: GMT'0 :: TZLabel
+ Data.Time.TZInfo: GMT0 :: TZLabel
+ Data.Time.TZInfo: GMT_0 :: TZLabel
+ Data.Time.TZInfo: Greenwich :: TZLabel
+ Data.Time.TZInfo: HST :: TZLabel
+ Data.Time.TZInfo: Hongkong :: TZLabel
+ Data.Time.TZInfo: Iceland :: TZLabel
+ Data.Time.TZInfo: Indian__Antananarivo :: TZLabel
+ Data.Time.TZInfo: Indian__Christmas :: TZLabel
+ Data.Time.TZInfo: Indian__Cocos :: TZLabel
+ Data.Time.TZInfo: Indian__Comoro :: TZLabel
+ Data.Time.TZInfo: Indian__Kerguelen :: TZLabel
+ Data.Time.TZInfo: Indian__Mahe :: TZLabel
+ Data.Time.TZInfo: Indian__Mayotte :: TZLabel
+ Data.Time.TZInfo: Indian__Reunion :: TZLabel
+ Data.Time.TZInfo: Iran :: TZLabel
+ Data.Time.TZInfo: Israel :: TZLabel
+ Data.Time.TZInfo: Jamaica :: TZLabel
+ Data.Time.TZInfo: Japan :: TZLabel
+ Data.Time.TZInfo: Kwajalein :: TZLabel
+ Data.Time.TZInfo: Libya :: TZLabel
+ Data.Time.TZInfo: MET :: TZLabel
+ Data.Time.TZInfo: MST :: TZLabel
+ Data.Time.TZInfo: MST7MDT :: TZLabel
+ Data.Time.TZInfo: Mexico__BajaNorte :: TZLabel
+ Data.Time.TZInfo: Mexico__BajaSur :: TZLabel
+ Data.Time.TZInfo: Mexico__General :: TZLabel
+ Data.Time.TZInfo: NZ :: TZLabel
+ Data.Time.TZInfo: NZ_CHAT :: TZLabel
+ Data.Time.TZInfo: Navajo :: TZLabel
+ Data.Time.TZInfo: PRC :: TZLabel
+ Data.Time.TZInfo: PST8PDT :: TZLabel
+ Data.Time.TZInfo: Pacific__Chuuk :: TZLabel
+ Data.Time.TZInfo: Pacific__Enderbury :: TZLabel
+ Data.Time.TZInfo: Pacific__Funafuti :: TZLabel
+ Data.Time.TZInfo: Pacific__Johnston :: TZLabel
+ Data.Time.TZInfo: Pacific__Majuro :: TZLabel
+ Data.Time.TZInfo: Pacific__Midway :: TZLabel
+ Data.Time.TZInfo: Pacific__Pohnpei :: TZLabel
+ Data.Time.TZInfo: Pacific__Ponape :: TZLabel
+ Data.Time.TZInfo: Pacific__Saipan :: TZLabel
+ Data.Time.TZInfo: Pacific__Samoa :: TZLabel
+ Data.Time.TZInfo: Pacific__Truk :: TZLabel
+ Data.Time.TZInfo: Pacific__Wake :: TZLabel
+ Data.Time.TZInfo: Pacific__Wallis :: TZLabel
+ Data.Time.TZInfo: Pacific__Yap :: TZLabel
+ Data.Time.TZInfo: Poland :: TZLabel
+ Data.Time.TZInfo: Portugal :: TZLabel
+ Data.Time.TZInfo: ROC :: TZLabel
+ Data.Time.TZInfo: ROK :: TZLabel
+ Data.Time.TZInfo: Singapore :: TZLabel
+ Data.Time.TZInfo: Turkey :: TZLabel
+ Data.Time.TZInfo: UCT :: TZLabel
+ Data.Time.TZInfo: US__Alaska :: TZLabel
+ Data.Time.TZInfo: US__Aleutian :: TZLabel
+ Data.Time.TZInfo: US__Arizona :: TZLabel
+ Data.Time.TZInfo: US__Central :: TZLabel
+ Data.Time.TZInfo: US__East_Indiana :: TZLabel
+ Data.Time.TZInfo: US__Eastern :: TZLabel
+ Data.Time.TZInfo: US__Hawaii :: TZLabel
+ Data.Time.TZInfo: US__Indiana_Starke :: TZLabel
+ Data.Time.TZInfo: US__Michigan :: TZLabel
+ Data.Time.TZInfo: US__Mountain :: TZLabel
+ Data.Time.TZInfo: US__Pacific :: TZLabel
+ Data.Time.TZInfo: US__Samoa :: TZLabel
+ Data.Time.TZInfo: UTC :: TZLabel
+ Data.Time.TZInfo: Universal :: TZLabel
+ Data.Time.TZInfo: WET :: TZLabel
+ Data.Time.TZInfo: W_SU :: TZLabel
+ Data.Time.TZInfo: Zulu :: TZLabel
+ Data.Time.TZTime.Internal: instance GHC.Records.HasField "tzTimeLocalTime" Data.Time.TZTime.Internal.TZTime Data.Time.LocalTime.Internal.LocalTime.LocalTime
+ Data.Time.TZTime.Internal: instance GHC.Records.HasField "tzTimeOffset" Data.Time.TZTime.Internal.TZTime Data.Time.LocalTime.Internal.TimeZone.TimeZone
+ Data.Time.TZTime.Internal: instance GHC.Records.HasField "tzTimeTZInfo" Data.Time.TZTime.Internal.TZTime Data.Time.TZInfo.TZInfo
Files
- README.md +4/−0
- src/Data/Time/TZTime/Internal.hs +40/−0
- tztime.cabal +7/−6
README.md view
@@ -7,6 +7,10 @@ <!-- TOC ignore:true --> # tztime +[](https://github.com/serokell/tztime/actions)+[](https://hackage.haskell.org/package/tztime)+[](https://opensource.org/licenses/MPL-2.0)+ This package introduces: * The `TZTime` data type, a valid and unambiguous point in time in some time zone. * Functions for safely manipulating a `TZTime`.
src/Data/Time/TZTime/Internal.hs view
@@ -31,6 +31,7 @@ import Data.Time.Zones (LocalToUTCResult(..)) import Data.Time.Zones qualified as TZ import GHC.Generics (Generic)+import GHC.Records (HasField(..)) import GHC.Stack (HasCallStack) import Text.ParserCombinators.ReadP (ReadP) import Text.ParserCombinators.ReadP qualified as P@@ -67,6 +68,38 @@ where tzIdent = T.unpack $ tziIdentifier tzi +----------------------------------------------------------------------------+-- TZTime fields+----------------------------------------------------------------------------+{-+Note: We do not want users to be able to unsafely modify `TZTime`'s fields.++For that reason, the `Data.Time.TZTime` module does+not export its fields`; it exports functions like `tzTimeLocalTime` instead.++We also export `HasField` instances for compatibility with `OverloadedRecordDot`.++>>> import Data.Time.TZInfo as TZInfo+>>> tz = fromPOSIXTime (TZInfo.fromLabel TZInfo.Europe__Rome) 0+>>>+>>> :set -XOverloadedRecordDot+>>> tz.tzTimeLocalTime+1970-01-01 01:00:00++## WARNING! ##++According to <https://gitlab.haskell.org/ghc/ghc/-/wikis/records/overloaded-record-fields>,+there are plans to add `setField` to the `HasField` class, which could then+be used to implement `OverloadedRecordUpdate`.+This conflicts with our intent: we only want to support `OverloadedRecordDot`,+but NOT `OverloadedRecordUpdate`!++There are also proposals to split the `HasField` class in two.++If `setField` is indeed added to the `HasField` class, we'll have to drop these instances.+If the `HasField` class is split in two, that's not a problem.+-}+ -- | The local time of this `TZTime`. tzTimeLocalTime :: TZTime -> LocalTime tzTimeLocalTime = tztLocalTime@@ -78,6 +111,13 @@ -- | The offset observed in this time zone at this moment in time. tzTimeOffset :: TZTime -> TimeZone tzTimeOffset = tztOffset++-- | @since 0.1.1.0+instance HasField "tzTimeLocalTime" TZTime LocalTime where getField = tzTimeLocalTime+-- | @since 0.1.1.0+instance HasField "tzTimeTZInfo" TZTime TZInfo where getField = tzTimeTZInfo+-- | @since 0.1.1.0+instance HasField "tzTimeOffset" TZTime TimeZone where getField = tzTimeOffset ---------------------------------------------------------------------------- -- Constructors
tztime.cabal view
@@ -1,11 +1,11 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4.+-- This file has been generated from package.yaml by hpack version 0.35.0. -- -- see: https://github.com/sol/hpack name: tztime-version: 0.1.0.0+version: 0.1.1.0 synopsis: Safe timezone-aware handling of time. description: This package introduces: .@@ -23,7 +23,8 @@ tested-with: GHC == 8.10.7 , GHC == 9.0.2- , GHC == 9.2.4+ , GHC == 9.2.8+ , GHC == 9.4.7 extra-source-files: README.md @@ -107,9 +108,9 @@ , time >=1.9.2 , time-compat >=1.9.4 , tz >=0.1.3.4+ default-language: Haskell2010 if impl(ghc >= 9.2) ghc-options: -Wno-missing-kind-signatures- default-language: Haskell2010 test-suite tztime-doctest type: exitcode-stdio-1.0@@ -175,9 +176,9 @@ build-depends: base , doctest-parallel+ default-language: Haskell2010 if impl(ghc >= 9.2) ghc-options: -Wno-missing-kind-signatures- default-language: Haskell2010 test-suite tztime-test type: exitcode-stdio-1.0@@ -258,6 +259,6 @@ , time , time-compat , tztime+ default-language: Haskell2010 if impl(ghc >= 9.2) ghc-options: -Wno-missing-kind-signatures- default-language: Haskell2010