Visitar URL original
Matt/ghc 9.2 by parsonsmatt · Pull Request #1367 · yesodweb/persistent · GitHub
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
3 changes: 2 additions & 1 deletion .github/workflows/haskell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,14 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
cabal: ["3.4"]
cabal: ["3.6"]
ghc:
- "8.4.4"
- "8.6.5"
- "8.8.4"
- "8.10.3"
- "9.0"
- "9.2.2"

env:
CONFIG: "--enable-tests --enable-benchmarks"
Expand Down
8 changes: 8 additions & 0 deletions persistent-mongoDB/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog for persistent-mongoDB

## 2.13.0.1

* [#1367](https://github.com/yesodweb/persistent/pull/1367),
[#1366](https://github.com/yesodweb/persistent/pull/1367),
[#1338](https://github.com/yesodweb/persistent/pull/1338),
[#1335](https://github.com/yesodweb/persistent/pull/1335)
* Support GHC 9.2

## 2.13.0.0

* Fix persistent 2.13 changes [#1286](https://github.com/yesodweb/persistent/pull/1286)
Expand Down
2 changes: 1 addition & 1 deletion persistent-mongoDB/persistent-mongoDB.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: persistent-mongoDB
version: 2.13.0.0
version: 2.13.0.1
license: MIT
license-file: LICENSE
author: Greg Weber <greg@gregweber.info>
Expand Down
1 change: 1 addition & 0 deletions persistent-mongoDB/test/EmbedTestMongo.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{-# LANGUAGE EmptyDataDecls #-}
{-# LANGUAGE DataKinds, ExistentialQuantification #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE MultiParamTypeClasses #-}
Expand Down
1 change: 1 addition & 0 deletions persistent-mongoDB/test/EntityEmbedTestMongo.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{-# LANGUAGE EmptyDataDecls #-}
{-# LANGUAGE DataKinds, ExistentialQuantification #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE QuasiQuotes #-}
Expand Down
1 change: 1 addition & 0 deletions persistent-mongoDB/test/main.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{-# LANGUAGE EmptyDataDecls #-}
{-# LANGUAGE DataKinds, ExistentialQuantification #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE QuasiQuotes #-}
Expand Down
8 changes: 8 additions & 0 deletions persistent-mysql/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog for persistent-mysql

## 2.13.1.2

* [#1367](https://github.com/yesodweb/persistent/pull/1367),
[#1366](https://github.com/yesodweb/persistent/pull/1367),
[#1338](https://github.com/yesodweb/persistent/pull/1338),
[#1335](https://github.com/yesodweb/persistent/pull/1335)
* Support GHC 9.2

## 2.13.1.1

* [#1360](https://github.com/yesodweb/persistent/pull/1360)
Expand Down
2 changes: 1 addition & 1 deletion persistent-mysql/persistent-mysql.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: persistent-mysql
version: 2.13.1.1
version: 2.13.1.2
license: MIT
license-file: LICENSE
author: Felipe Lessa <felipe.lessa@gmail.com>, Michael Snoyman
Expand Down
1 change: 1 addition & 0 deletions persistent-mysql/test/main.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MultiParamTypeClasses #-}
Expand Down
8 changes: 8 additions & 0 deletions persistent-postgresql/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog for persistent-postgresql

## 2.13.4.1

* [#1367](https://github.com/yesodweb/persistent/pull/1367),
[#1366](https://github.com/yesodweb/persistent/pull/1367),
[#1338](https://github.com/yesodweb/persistent/pull/1338),
[#1335](https://github.com/yesodweb/persistent/pull/1335)
* Support GHC 9.2

## 2.13.4.0

* [#1341](https://github.com/yesodweb/persistent/pull/1341)
Expand Down
2 changes: 1 addition & 1 deletion persistent-postgresql/persistent-postgresql.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: persistent-postgresql
version: 2.13.4.0
version: 2.13.4.1
license: MIT
license-file: LICENSE
author: Felipe Lessa, Michael Snoyman <michael@snoyman.com>
Expand Down
1 change: 1 addition & 0 deletions persistent-postgresql/test/main.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MultiParamTypeClasses #-}
Expand Down
8 changes: 8 additions & 0 deletions persistent-redis/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 2.13.0.1

* [#1367](https://github.com/yesodweb/persistent/pull/1367),
[#1366](https://github.com/yesodweb/persistent/pull/1367),
[#1338](https://github.com/yesodweb/persistent/pull/1338),
[#1335](https://github.com/yesodweb/persistent/pull/1335)
* Support GHC 9.2

## 2.13.0.0

* [#1123](https://github.com/yesodweb/persistent/pull/1223):
Expand Down
28 changes: 14 additions & 14 deletions persistent-redis/persistent-redis.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: persistent-redis
version: 2.13.0.0
version: 2.13.0.1
license: BSD3
license-file: LICENSE
author: Pavel Ryzhov <paul@paulrz.cz>
Expand All @@ -21,7 +21,7 @@ library
, persistent >= 2.12 && < 3.0
, aeson >= 1.0
, binary >= 0.8 && < 0.9
, bytestring >= 0.10.8 && < 0.11
, bytestring >= 0.10.8 && < 0.12
, hedis >= 0.9
, http-api-data
, mtl >= 2.2.1 && < 2.3
Expand All @@ -47,22 +47,22 @@ library
test-suite basic
type: exitcode-stdio-1.0
main-is: tests/basic-test.hs
build-depends: base >= 4.9 && < 5
, persistent >= 2.10 && < 3.0
build-depends: base
, persistent
, persistent-redis
, aeson >= 1.0
, bytestring >= 0.10.8 && < 0.11
, binary >= 0.8 && < 0.9
, hedis >= 0.9
, aeson
, bytestring
, binary
, hedis
, http-api-data
, mtl >= 2.2.1 && < 2.3
, path-pieces >= 0.2
, mtl
, path-pieces
, scientific
, template-haskell
, text >= 1.2
, time >= 1.6
, transformers >= 0.5 && < 0.6
, utf8-string >= 1.0 && < 1.1
, text
, time
, transformers
, utf8-string

other-modules: Database.Persist.Redis
Database.Persist.Redis.Config
Expand Down
7 changes: 7 additions & 0 deletions persistent-test/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
## Unreleased changes

## 2.13.1.2

* [#1367](https://github.com/yesodweb/persistent/pull/1367),
[#1366](https://github.com/yesodweb/persistent/pull/1367),
[#1338](https://github.com/yesodweb/persistent/pull/1338),
[#1335](https://github.com/yesodweb/persistent/pull/1335)
* Support GHC 9.2
* Test migration idempotency on additional integer types [#1359](https://github.com/yesodweb/persistent/pull/1359)

## 2.13.1.0
Expand Down
2 changes: 1 addition & 1 deletion persistent-test/persistent-test.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: persistent-test
version: 2.13.1.1
version: 2.13.1.2
license: MIT
license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com>
Expand Down
2 changes: 1 addition & 1 deletion persistent-test/src/DataTypeTest.hs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ cleanDB'
cleanDB' = deleteWhere ([] :: [Filter (DataTypeTableGeneric backend)])

roundFn :: RealFrac a => a -> Integer
roundFn = round
roundFn = truncate

roundTime :: TimeOfDay -> TimeOfDay
roundTime t = timeToTimeOfDay $ fromIntegral $ roundFn $ timeOfDayToTime t
Expand Down
7 changes: 6 additions & 1 deletion persistent/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# Changelog for persistent

## (unreleased)
# 2.13.3.1

* [#1367](https://github.com/yesodweb/persistent/pull/1367),
[#1366](https://github.com/yesodweb/persistent/pull/1367),
[#1338](https://github.com/yesodweb/persistent/pull/1338),
[#1335](https://github.com/yesodweb/persistent/pull/1335)
* Support GHC 9.2
* [#1356](https://github.com/yesodweb/persistent/pull/1356)
* Improve parse errors in generated FromJSON instances

Expand Down
23 changes: 14 additions & 9 deletions persistent/Database/Persist/Class/PersistField.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import qualified Data.ByteString.Lazy as L
import Data.Fixed
import Data.Int (Int8, Int16, Int32, Int64)
import qualified Data.IntMap as IM
import qualified Data.List.NonEmpty as NonEmpty
import qualified Data.Map as M
import qualified Data.Set as S
import Data.Text (Text)
Expand Down Expand Up @@ -308,22 +309,26 @@ instance PersistField UTCTime where
fromPersistValue x@(PersistText t) =
let s = T.unpack t
in
case reads s of
(d, _):_ -> Right d
_ ->
case NonEmpty.nonEmpty (reads s) of
Nothing ->
case parse8601 s <|> parsePretty s of
Nothing -> Left $ fromPersistValueParseError "UTCTime" x
Just x' -> Right x'
Just matches ->
-- The 'Read UTCTime' instance in newer versions of 'time' is
-- more flexible when parsing UTCTime strings and will return
-- UTCTimes with different microsecond parsings. The last result
-- here contains the parsed UTCTime with as much microsecond
-- precision parsed as posssible.
Right $ fst $ NonEmpty.last matches
where
#if MIN_VERSION_time(1,5,0)
parse8601 = parseTimeM True defaultTimeLocale format8601
parsePretty = parseTimeM True defaultTimeLocale formatPretty
parseTime' = parseTimeM True defaultTimeLocale
#else
parse8601 = parseTime defaultTimeLocale format8601
parsePretty = parseTime defaultTimeLocale formatPretty
parseTime' = parseTime defaultTimeLocale
#endif
format8601 = "%FT%T%Q"
formatPretty = "%F %T%Q"
parse8601 = parseTime' "%FT%T%Q"
parsePretty = parseTime' "%F %T%Q"
fromPersistValue x@(PersistByteString s) =
case reads $ unpack s of
(d, _):_ -> Right d
Expand Down
Loading