Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package ghc-persistent for openSUSE:Factory checked in at 2021-06-01 10:39:09 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-persistent (Old) and /work/SRC/openSUSE:Factory/.ghc-persistent.new.1898 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-persistent" Tue Jun 1 10:39:09 2021 rev:28 rq:896218 version:2.13.0.2 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-persistent/ghc-persistent.changes 2021-05-11 23:04:15.896929064 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-persistent.new.1898/ghc-persistent.changes 2021-06-01 10:40:46.601151671 +0200 @@ -1,0 +2,18 @@ +Wed May 26 08:45:16 UTC 2021 - psim...@suse.com + +- Update persistent to version 2.13.0.2. + ## 2.13.0.2 + + * [#1265](https://github.com/yesodweb/persistent/pull/1265) + * Support GHC 9 + +------------------------------------------------------------------- +Tue May 11 17:19:27 UTC 2021 - psim...@suse.com + +- Update persistent to version 2.13.0.1. + Upstream has edited the change log file since the last release in + a non-trivial way, i.e. they did more than just add a new entry + at the top. You can review the file at: + http://hackage.haskell.org/package/persistent-2.13.0.1/src/ChangeLog.md + +------------------------------------------------------------------- Old: ---- persistent-2.13.0.0.tar.gz persistent.cabal New: ---- persistent-2.13.0.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-persistent.spec ++++++ --- /var/tmp/diff_new_pack.Hoo80u/_old 2021-06-01 10:40:47.161152624 +0200 +++ /var/tmp/diff_new_pack.Hoo80u/_new 2021-06-01 10:40:47.165152631 +0200 @@ -19,13 +19,12 @@ %global pkg_name persistent %bcond_with tests Name: ghc-%{pkg_name} -Version: 2.13.0.0 +Version: 2.13.0.2 Release: 0 Summary: Type-safe, multi-backend data serialization License: MIT URL: https://hackage.haskell.org/package/%{pkg_name} Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz -Source1: https://hackage.haskell.org/package/%{pkg_name}-%{version}/revision/2.cabal#/%{pkg_name}.cabal BuildRequires: ghc-Cabal-devel BuildRequires: ghc-aeson-devel BuildRequires: ghc-attoparsec-devel @@ -78,7 +77,6 @@ %prep %autosetup -n %{pkg_name}-%{version} -cp -p %{SOURCE1} %{pkg_name}.cabal %build %ghc_lib_build ++++++ persistent-2.13.0.0.tar.gz -> persistent-2.13.0.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/persistent-2.13.0.0/ChangeLog.md new/persistent-2.13.0.2/ChangeLog.md --- old/persistent-2.13.0.0/ChangeLog.md 2021-05-05 23:10:43.000000000 +0200 +++ new/persistent-2.13.0.2/ChangeLog.md 2021-05-24 17:18:53.000000000 +0200 @@ -1,5 +1,15 @@ # Changelog for persistent +## 2.13.0.2 + +* [#1265](https://github.com/yesodweb/persistent/pull/1265) + * Support GHC 9 + +## 2.13.0.1 + +* [#1268](https://github.com/yesodweb/persistent/pull/1268) + * Show `keyFromValues` error + ## 2.13.0.0 * [#1244](https://github.com/yesodweb/persistent/pull/1244) @@ -11,7 +21,7 @@ Please use `mkEntityDefList` instead. * `EntityDef` will now include fields marked `MigrationOnly` and `SafeToRemove`. Beforehand, those were filtered out, and `mkMigrate` - applied. The function `getEntityFields` wll only return fields defined on + applied. The function `getEntityFields` will only return fields defined on the Haskell type - for all columns, see `getEntityFieldsDatabase`. * [#1225](https://github.com/yesodweb/persistent/pull/1225) * The fields and constructor for `SqlBackend` are no longer exported by @@ -26,16 +36,18 @@ directly, use `mkSqlBackend` and the datatype `MkSqlBackendArgs`. The `MkSqlBackendArgs` record has the same field names as the `SqlBackend`, so the translation is easy: - ```diff -- SqlBackend -+ mkSqlBackend MkSqlBackendArgs - { connInsertSql = ... - , connCommit = ... - , connEscapeFieldName = ... - , connEscapeTableName = ... - , etc - } - ``` + + ```diff + - SqlBackend + + mkSqlBackend MkSqlBackendArgs + { connInsertSql = ... + , connCommit = ... + , connEscapeFieldName = ... + , connEscapeTableName = ... + , etc + } + ``` + Some fields were omitted in `MkSqlBackendArgs`. These fields are *optional* - they provide enhanced or backend-specific functionality. For these, use the setter functions like `setConnUpsertSql`. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/persistent-2.13.0.0/Database/Persist/Class/PersistConfig.hs new/persistent-2.13.0.2/Database/Persist/Class/PersistConfig.hs --- old/persistent-2.13.0.0/Database/Persist/Class/PersistConfig.hs 2021-02-26 21:44:09.000000000 +0100 +++ new/persistent-2.13.0.2/Database/Persist/Class/PersistConfig.hs 2021-05-24 17:18:53.000000000 +0200 @@ -6,12 +6,13 @@ import Data.Aeson (Value (Object)) import Data.Aeson.Types (Parser) import qualified Data.HashMap.Strict as HashMap +import Data.Kind (Type) -- | Represents a value containing all the configuration options for a specific -- backend. This abstraction makes it easier to write code that can easily swap -- backends. class PersistConfig c where - type PersistConfigBackend c :: (* -> *) -> * -> * + type PersistConfigBackend c :: (Type -> Type) -> Type -> Type type PersistConfigPool c -- | Load the config settings from a 'Value', most likely taken from a YAML diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/persistent-2.13.0.0/Database/Persist/Class/PersistEntity.hs new/persistent-2.13.0.2/Database/Persist/Class/PersistEntity.hs --- old/persistent-2.13.0.0/Database/Persist/Class/PersistEntity.hs 2021-05-05 23:10:13.000000000 +0200 +++ new/persistent-2.13.0.2/Database/Persist/Class/PersistEntity.hs 2021-05-24 17:18:53.000000000 +0200 @@ -49,7 +49,6 @@ import qualified Data.HashMap.Strict as HM import Data.List.NonEmpty (NonEmpty(..)) import Data.Maybe (isJust) -import Data.Monoid (mappend) import Data.Text (Text) import qualified Data.Text as T import qualified Data.Text.Encoding as TE @@ -58,6 +57,7 @@ import GHC.Generics import GHC.OverloadedLabels import GHC.TypeLits +import Data.Kind (Type) import Database.Persist.Class.PersistField import Database.Persist.Names @@ -102,7 +102,7 @@ -- As of @persistent-2.11.0.0@, it's possible to use the @OverloadedLabels@ -- language extension to refer to 'EntityField' values polymorphically. See -- the documentation on 'SymbolToField' for more information. - data EntityField record :: * -> * + data EntityField record :: Type -> Type -- | Return meta-data for a given 'EntityField'. persistFieldDef :: EntityField record typ -> FieldDef -- | A meta-operation to get the database fields of a record. @@ -317,7 +317,7 @@ _ -> error $ T.unpack $ errMsg "expected PersistMap" fromPersistValue (PersistMap alist) = case after of - [] -> Left $ errMsg $ "did not find " `Data.Monoid.mappend` idField `mappend` " field" + [] -> Left $ errMsg $ "did not find " `mappend` idField `mappend` " field" ("_id", kv):afterRest -> fromPersistValue (PersistMap (before ++ afterRest)) >>= \record -> keyFromValues [kv] >>= \k -> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/persistent-2.13.0.0/Database/Persist/Class/PersistField.hs new/persistent-2.13.0.2/Database/Persist/Class/PersistField.hs --- old/persistent-2.13.0.0/Database/Persist/Class/PersistField.hs 2021-04-07 23:18:57.000000000 +0200 +++ new/persistent-2.13.0.2/Database/Persist/Class/PersistField.hs 2021-05-24 17:18:53.000000000 +0200 @@ -20,7 +20,6 @@ import Data.Int (Int8, Int16, Int32, Int64) import qualified Data.IntMap as IM import qualified Data.Map as M -import Data.Monoid ((<>)) import qualified Data.Set as S import Data.Text (Text) import qualified Data.Text as T diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/persistent-2.13.0.0/Database/Persist/Quasi/Internal.hs new/persistent-2.13.0.2/Database/Persist/Quasi/Internal.hs --- old/persistent-2.13.0.0/Database/Persist/Quasi/Internal.hs 2021-05-05 23:10:13.000000000 +0200 +++ new/persistent-2.13.0.2/Database/Persist/Quasi/Internal.hs 2021-05-24 17:18:53.000000000 +0200 @@ -924,7 +924,7 @@ | n == "Foreign" = (Nothing, Nothing, Nothing, Just $ takeForeign ps entityName rest) | n == "Primary" = - (Nothing, Just $ takeComposite ps defNames rest, Nothing, Nothing) + (Nothing, Just $ takeComposite defNames rest, Nothing, Nothing) | n == "Id" = (Just $ takeId ps entityName rest, Nothing, Nothing, Nothing) | otherwise = @@ -1012,11 +1012,10 @@ deriving (Show, Lift) takeComposite - :: PersistSettings - -> [FieldNameHS] + :: [FieldNameHS] -> [Text] -> UnboundCompositeDef -takeComposite ps fields pkcols = +takeComposite fields pkcols = UnboundCompositeDef { unboundCompositeCols = map (getDef fields) cols diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/persistent-2.13.0.0/Database/Persist/Sql/Class.hs new/persistent-2.13.0.2/Database/Persist/Sql/Class.hs --- old/persistent-2.13.0.0/Database/Persist/Sql/Class.hs 2021-05-05 23:10:13.000000000 +0200 +++ new/persistent-2.13.0.2/Database/Persist/Sql/Class.hs 2021-05-24 17:18:53.000000000 +0200 @@ -22,7 +22,6 @@ import qualified Data.IntMap as IM import qualified Data.Map as M import Data.Maybe (fromMaybe) -import Data.Monoid ((<>)) import Data.Proxy (Proxy(..)) import qualified Data.Set as S import Data.Text (Text, intercalate, pack) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/persistent-2.13.0.0/Database/Persist/Sql/Orphan/PersistQuery.hs new/persistent-2.13.0.2/Database/Persist/Sql/Orphan/PersistQuery.hs --- old/persistent-2.13.0.0/Database/Persist/Sql/Orphan/PersistQuery.hs 2021-05-05 23:10:13.000000000 +0200 +++ new/persistent-2.13.0.2/Database/Persist/Sql/Orphan/PersistQuery.hs 2021-05-24 17:18:53.000000000 +0200 @@ -23,7 +23,7 @@ import Data.Int (Int64) import Data.List (find, inits, transpose) import Data.Maybe (isJust) -import Data.Monoid (Monoid(..), (<>)) +import Data.Monoid (Monoid(..)) import Data.Text (Text) import qualified Data.Text as T import Data.Foldable (toList) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/persistent-2.13.0.0/Database/Persist/Sql/Orphan/PersistStore.hs new/persistent-2.13.0.2/Database/Persist/Sql/Orphan/PersistStore.hs --- old/persistent-2.13.0.0/Database/Persist/Sql/Orphan/PersistStore.hs 2021-05-05 23:10:13.000000000 +0200 +++ new/persistent-2.13.0.2/Database/Persist/Sql/Orphan/PersistStore.hs 2021-05-24 17:18:53.000000000 +0200 @@ -30,7 +30,6 @@ import Data.List (find, nubBy) import qualified Data.Map as Map import Data.Maybe (isJust) -import Data.Monoid (mappend, (<>)) import Data.Text (Text, unpack) import qualified Data.Text as T import Data.Void (Void) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/persistent-2.13.0.0/Database/Persist/Sql/Orphan/PersistUnique.hs new/persistent-2.13.0.2/Database/Persist/Sql/Orphan/PersistUnique.hs --- old/persistent-2.13.0.0/Database/Persist/Sql/Orphan/PersistUnique.hs 2021-05-05 23:10:13.000000000 +0200 +++ new/persistent-2.13.0.2/Database/Persist/Sql/Orphan/PersistUnique.hs 2021-05-24 17:18:53.000000000 +0200 @@ -10,7 +10,6 @@ import qualified Data.Conduit.List as CL import Data.Function (on) import Data.List (nubBy) -import Data.Monoid (mappend) import qualified Data.Text as T import Data.Foldable (toList) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/persistent-2.13.0.0/Database/Persist/Sql/Run.hs new/persistent-2.13.0.2/Database/Persist/Sql/Run.hs --- old/persistent-2.13.0.0/Database/Persist/Sql/Run.hs 2021-05-05 23:10:13.000000000 +0200 +++ new/persistent-2.13.0.2/Database/Persist/Sql/Run.hs 2021-05-24 17:18:53.000000000 +0200 @@ -10,7 +10,6 @@ import Control.Monad.Trans.Resource import Data.Acquire (Acquire, ReleaseType(..), mkAcquireType, with) import Data.IORef (readIORef) -import Data.Pool (Pool) import Data.Pool as P import qualified Data.Map as Map import qualified Data.Text as T diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/persistent-2.13.0.0/Database/Persist/Sql/Types/Internal.hs new/persistent-2.13.0.2/Database/Persist/Sql/Types/Internal.hs --- old/persistent-2.13.0.0/Database/Persist/Sql/Types/Internal.hs 2021-05-05 23:10:13.000000000 +0200 +++ new/persistent-2.13.0.2/Database/Persist/Sql/Types/Internal.hs 2021-05-24 17:18:53.000000000 +0200 @@ -29,7 +29,6 @@ import Control.Monad.Trans.Class (lift) import Control.Monad.Trans.Reader (ReaderT, runReaderT, ask) -import Data.Monoid ((<>)) import Database.Persist.Class ( HasPersistBackend (..) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/persistent-2.13.0.0/Database/Persist/Sql/Types.hs new/persistent-2.13.0.2/Database/Persist/Sql/Types.hs --- old/persistent-2.13.0.0/Database/Persist/Sql/Types.hs 2021-05-05 23:10:13.000000000 +0200 +++ new/persistent-2.13.0.2/Database/Persist/Sql/Types.hs 2021-05-24 17:18:53.000000000 +0200 @@ -8,8 +8,6 @@ , ConnectionPoolConfig(..) ) where -import Database.Persist.Types.Base (FieldCascade) - import Control.Exception (Exception(..)) import Control.Monad.Logger (NoLoggingT) import Control.Monad.Trans.Reader (ReaderT(..)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/persistent-2.13.0.0/Database/Persist/Sql/Util.hs new/persistent-2.13.0.2/Database/Persist/Sql/Util.hs --- old/persistent-2.13.0.0/Database/Persist/Sql/Util.hs 2021-05-05 23:10:13.000000000 +0200 +++ new/persistent-2.13.0.2/Database/Persist/Sql/Util.hs 2021-05-24 17:18:53.000000000 +0200 @@ -22,7 +22,6 @@ import Data.List.NonEmpty (NonEmpty(..)) import qualified Data.Maybe as Maybe -import Data.Monoid ((<>)) import Data.Text (Text, pack) import qualified Data.Text as T @@ -188,7 +187,8 @@ case fromPersistValues xs of Left e -> Left e Right xs' -> case keyFromValues keyvals of - Left _ -> error "fromPersistValuesComposite': keyFromValues failed" + Left err -> error $ "fromPersistValuesComposite': keyFromValues failed with error: " + <> T.unpack err Right key -> Right (Entity key xs') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/persistent-2.13.0.0/Database/Persist/SqlBackend/Internal/IsolationLevel.hs new/persistent-2.13.0.2/Database/Persist/SqlBackend/Internal/IsolationLevel.hs --- old/persistent-2.13.0.0/Database/Persist/SqlBackend/Internal/IsolationLevel.hs 2021-05-05 23:10:13.000000000 +0200 +++ new/persistent-2.13.0.2/Database/Persist/SqlBackend/Internal/IsolationLevel.hs 2021-05-24 17:18:53.000000000 +0200 @@ -1,7 +1,6 @@ module Database.Persist.SqlBackend.Internal.IsolationLevel where import Data.String (IsString(..)) -import Data.Monoid ((<>)) -- TODO: remove when GHC-8.2 support is dropped -- | Please refer to the documentation for the database in question for a full -- overview of the semantics of the varying isloation levels diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/persistent-2.13.0.0/Database/Persist/TH.hs new/persistent-2.13.0.2/Database/Persist/TH.hs --- old/persistent-2.13.0.0/Database/Persist/TH.hs 2021-05-05 23:10:13.000000000 +0200 +++ new/persistent-2.13.0.2/Database/Persist/TH.hs 2021-05-24 17:18:53.000000000 +0200 @@ -97,7 +97,6 @@ import qualified Data.List.NonEmpty as NEL import qualified Data.Map as M import Data.Maybe (fromMaybe, isJust, listToMaybe, mapMaybe) -import Data.Monoid (mappend, mconcat, (<>)) import Data.Proxy (Proxy(Proxy)) import Data.Text (Text, concat, cons, pack, stripSuffix, uncons, unpack) import qualified Data.Text as T @@ -124,7 +123,7 @@ import Database.Persist.Sql (Migration, PersistFieldSql, SqlBackend, migrate, sqlType) -import Database.Persist.EntityDef.Internal (EntityDef(..), EntityIdDef(..)) +import Database.Persist.EntityDef.Internal (EntityDef(..)) import Database.Persist.ImplicitIdDef (autoIncrementingInteger) import Database.Persist.ImplicitIdDef.Internal @@ -714,7 +713,7 @@ Left Nothing mEmbedded ents (FTTypeCon Nothing (EntityNameHS -> name)) = maybe (Left Nothing) (\_ -> Right name) $ M.lookup name ents -mEmbedded ents (FTTypePromoted (EntityNameHS -> name)) = +mEmbedded _ (FTTypePromoted _) = Left Nothing mEmbedded ents (FTList x) = mEmbedded ents x @@ -1026,8 +1025,14 @@ ) (nameFinal, paramsFinal) - | mpsGeneric mps = (mkEntityDefGenericName entDef, [PlainTV backendName]) - | otherwise = (mkEntityDefName entDef, []) + | mpsGeneric mps = + ( mkEntityDefGenericName entDef + , [ mkPlainTV backendName + ] + ) + + | otherwise = + (mkEntityDefName entDef, []) cols :: [VarBangType] cols = do @@ -1913,8 +1918,8 @@ sT = mkST backend1 tT = mkST backend2 t1 `arrow` t2 = ArrowT `AppT` t1 `AppT` t2 - vars = PlainTV fT - : (if mpsGeneric mps then [PlainTV backend1{-, PlainTV backend2-}] else []) + vars = mkForallTV fT + : (if mpsGeneric mps then [mkForallTV backend1{-, PlainTV backend2-}] else []) return [ SigD lensName $ ForallT vars [mkClassP ''Functor [VarT fT]] $ (aT `arrow` (VarT fT `AppT` bT)) `arrow` @@ -1933,6 +1938,33 @@ ] ] +#if MIN_VERSION_template_haskell(2,17,0) +mkPlainTV + :: Name + -> TyVarBndr () +mkPlainTV n = PlainTV n () + +mkDoE :: [Stmt] -> Exp +mkDoE stmts = DoE Nothing stmts + +mkForallTV :: Name -> TyVarBndr Specificity +mkForallTV n = PlainTV n SpecifiedSpec +#else + +mkDoE :: [Stmt] -> Exp +mkDoE = DoE + +mkPlainTV + :: Name + -> TyVarBndr +mkPlainTV = PlainTV + +mkForallTV + :: Name + -> TyVarBndr +mkForallTV = mkPlainTV +#endif + mkForeignKeysComposite :: MkPersistSettings -> UnboundEntityDef @@ -2168,7 +2200,7 @@ ] (ConT ''DeleteCascade `AppT` entityT `AppT` backendT) [ FunD 'deleteCascade - [normalClause [VarP key] (DoE stmts)] + [normalClause [VarP key] (mkDoE stmts)] ] -- | Creates a declaration for the @['EntityDef']@ from the @persistent@ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/persistent-2.13.0.0/bench/Main.hs new/persistent-2.13.0.2/bench/Main.hs --- old/persistent-2.13.0.0/bench/Main.hs 2021-03-26 20:15:27.000000000 +0100 +++ new/persistent-2.13.0.2/bench/Main.hs 2021-05-24 17:18:53.000000000 +0200 @@ -1,12 +1,14 @@ +{-# LANGUAGE BangPatterns #-} {-# LANGUAGE CPP #-} {-# LANGUAGE TemplateHaskell #-} + {-# OPTIONS_GHC -Wno-orphans #-} + module Main (main) where import Control.DeepSeq -import Control.DeepSeq.Generics import Criterion.Main -import Data.Text (Text) +import Data.Text (Text) import Language.Haskell.TH import Language.Haskell.TH.Syntax @@ -17,7 +19,7 @@ main :: IO () main = defaultMain [ bgroup "mkPersist" - [ bench "From File" $ nfIO $ mkPersist' $(persistFileWith lowerCaseSettings "bench/models-slowly") + [ -- bench "From File" $ nfIO $ mkPersist' $(persistFileWith lowerCaseSettings "bench/models-slowly") -- , bgroup "Non-Null Fields" -- [ bgroup "Increasing model count" -- [ bench "1x10" $ nfIO $ mkPersist' $( parseReferencesQ (mkModels 10 10)) @@ -55,137 +57,146 @@ -- Orphan instances for NFData Template Haskell types instance NFData Overlap where - rnf = genericRnf + instance NFData AnnTarget where - rnf = genericRnf + instance NFData RuleBndr where - rnf = genericRnf + instance NFData Role where - rnf = genericRnf + instance NFData Phases where - rnf = genericRnf + instance NFData InjectivityAnn where - rnf = genericRnf + instance NFData FamilyResultSig where - rnf = genericRnf + instance NFData RuleMatch where - rnf = genericRnf + instance NFData TypeFamilyHead where - rnf = genericRnf + instance NFData TySynEqn where - rnf = genericRnf + instance NFData Inline where - rnf = genericRnf + instance NFData Pragma where - rnf = genericRnf + instance NFData FixityDirection where - rnf = genericRnf + instance NFData Safety where - rnf = genericRnf + instance NFData Fixity where - rnf = genericRnf + instance NFData Callconv where - rnf = genericRnf + instance NFData Foreign where - rnf = genericRnf + instance NFData SourceStrictness where - rnf = genericRnf + instance NFData SourceUnpackedness where - rnf = genericRnf + instance NFData FunDep where - rnf = genericRnf + instance NFData Bang where - rnf = genericRnf + #if MIN_VERSION_template_haskell(2,12,0) instance NFData PatSynDir where - rnf = genericRnf + instance NFData PatSynArgs where - rnf = genericRnf + instance NFData DerivStrategy where - rnf = genericRnf + instance NFData DerivClause where - rnf = genericRnf + #endif instance NFData Con where - rnf = genericRnf + instance NFData Range where - rnf = genericRnf + instance NFData Clause where - rnf = genericRnf + instance NFData PkgName where - rnf = genericRnf + instance NFData Dec where - rnf = genericRnf + instance NFData Stmt where - rnf = genericRnf + instance NFData TyLit where - rnf = genericRnf + instance NFData NameSpace where - rnf = genericRnf + instance NFData Body where - rnf = genericRnf + instance NFData Guard where - rnf = genericRnf + instance NFData Match where - rnf = genericRnf + instance NFData ModName where - rnf = genericRnf + instance NFData Pat where - rnf = genericRnf +#if MIN_VERSION_template_haskell(2,16,0) +instance NFData Bytes where + rnf !_ = () +#endif + +#if MIN_VERSION_template_haskell(2,17,0) +instance NFData a => NFData (TyVarBndr a) where + +instance NFData Specificity +#else instance NFData TyVarBndr where - rnf = genericRnf + +#endif instance NFData NameFlavour where - rnf = genericRnf + instance NFData Type where - rnf = genericRnf + instance NFData Exp where - rnf = genericRnf + instance NFData Lit where - rnf = genericRnf instance NFData OccName where - rnf = genericRnf + instance NFData Name where - rnf = genericRnf + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/persistent-2.13.0.0/bench/Models.hs new/persistent-2.13.0.2/bench/Models.hs --- old/persistent-2.13.0.0/bench/Models.hs 2021-03-26 20:15:27.000000000 +0100 +++ new/persistent-2.13.0.2/bench/Models.hs 2021-05-24 17:18:53.000000000 +0200 @@ -5,10 +5,13 @@ import qualified Data.Text as Text import Database.Persist.Quasi +import Database.Persist.Quasi.Internal import Database.Persist.TH import Database.Persist.Sql -mkPersist' :: [EntityDef] -> IO [Dec] +-- TODO: we use lookupName and reify etc which breaks in IO. somehow need to +-- test this out elsewise +mkPersist' :: [UnboundEntityDef] -> IO [Dec] mkPersist' = runQ . mkPersist sqlSettings parseReferences' :: String -> IO Exp diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/persistent-2.13.0.0/persistent.cabal new/persistent-2.13.0.2/persistent.cabal --- old/persistent-2.13.0.0/persistent.cabal 2021-05-05 23:11:14.000000000 +0200 +++ new/persistent-2.13.0.2/persistent.cabal 2021-05-24 17:18:53.000000000 +0200 @@ -1,5 +1,5 @@ name: persistent -version: 2.13.0.0 +version: 2.13.0.2 license: MIT license-file: LICENSE author: Michael Snoyman <mich...@snoyman.com> @@ -166,6 +166,8 @@ Database.Persist.TH.ForeignRefSpec Database.Persist.TH.ImplicitIdColSpec Database.Persist.TH.JsonEncodingSpec + Database.Persist.TH.KindEntitiesSpec + Database.Persist.TH.KindEntitiesSpecImports Database.Persist.TH.MigrationOnlySpec Database.Persist.TH.MultiBlockSpec Database.Persist.TH.MultiBlockSpec.Model @@ -189,8 +191,7 @@ build-depends: base , persistent , criterion - , deepseq - , deepseq-generics + , deepseq >= 1.4 , file-embed , text , template-haskell diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/persistent-2.13.0.0/test/Database/Persist/TH/KindEntitiesSpec.hs new/persistent-2.13.0.2/test/Database/Persist/TH/KindEntitiesSpec.hs --- old/persistent-2.13.0.0/test/Database/Persist/TH/KindEntitiesSpec.hs 1970-01-01 01:00:00.000000000 +0100 +++ new/persistent-2.13.0.2/test/Database/Persist/TH/KindEntitiesSpec.hs 2021-05-05 20:34:12.000000000 +0200 @@ -0,0 +1,38 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE DerivingStrategies #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE OverloadedLabels #-} +{-# LANGUAGE QuasiQuotes #-} +{-# LANGUAGE StandaloneDeriving #-} +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE UndecidableInstances #-} + +module Database.Persist.TH.KindEntitiesSpec where + +import Database.Persist.TH.KindEntitiesSpecImports +import TemplateTestImports + +mkPersist sqlSettings [persistLowerCase| + +Customer + name String + age Int + +CustomerTransfer + customerId CustomerId + moneyAmount (MoneyAmount 'CustomerOwned 'Debit) +|] + +spec :: Spec +spec = describe "KindEntities" $ do + it "should support DataKinds in entity definition" $ do + let mkTransfer :: CustomerId -> MoneyAmount 'CustomerOwned 'Debit -> CustomerTransfer + mkTransfer = CustomerTransfer + getAmount :: CustomerTransfer -> MoneyAmount 'CustomerOwned 'Debit + getAmount = customerTransferMoneyAmount + compiles + +compiles :: Expectation +compiles = True `shouldBe` True diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/persistent-2.13.0.0/test/Database/Persist/TH/KindEntitiesSpecImports.hs new/persistent-2.13.0.2/test/Database/Persist/TH/KindEntitiesSpecImports.hs --- old/persistent-2.13.0.0/test/Database/Persist/TH/KindEntitiesSpecImports.hs 1970-01-01 01:00:00.000000000 +0100 +++ new/persistent-2.13.0.2/test/Database/Persist/TH/KindEntitiesSpecImports.hs 2021-05-05 20:34:12.000000000 +0200 @@ -0,0 +1,22 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE LambdaCase #-} + +module Database.Persist.TH.KindEntitiesSpecImports where + +import Data.Proxy +import qualified Data.Text as T +import TemplateTestImports + +data Owner = MerchantOwned | CustomerOwned +data AccountKind = Debit | Credit + +newtype MoneyAmount (a :: Owner) (b :: AccountKind) = MoneyAmount Rational + +instance PersistFieldSql (MoneyAmount a b) where + sqlType _ = sqlType (Proxy :: Proxy Rational) + +instance PersistField (MoneyAmount a b) where + toPersistValue (MoneyAmount n) = + toPersistValue n + fromPersistValue v = + MoneyAmount <$> fromPersistValue v