Hello community, here is the log from the commit of package ghc-persistent-template for openSUSE:Factory checked in at 2019-02-17 12:20:22 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-persistent-template (Old) and /work/SRC/openSUSE:Factory/.ghc-persistent-template.new.28833 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-persistent-template" Sun Feb 17 12:20:22 2019 rev:16 rq:674304 version:2.6.0 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-persistent-template/ghc-persistent-template.changes 2018-12-06 12:17:24.197514235 +0100 +++ /work/SRC/openSUSE:Factory/.ghc-persistent-template.new.28833/ghc-persistent-template.changes 2019-02-17 12:20:23.500216222 +0100 @@ -0,0 +1,8 @@ +------------------------------------------------------------------- +Mon Jan 28 03:02:08 UTC 2019 - psim...@suse.com + +- Update persistent-template to version 2.6.0. + ## 2.6.0 + * [persistent#846](https://github.com/yesodweb/persistent/pull/846): Improve error message when marshalling fails + * [persistent#826](https://github.com/yesodweb/persistent/pull/826): Change `Unique` derive `Show` + Old: ---- persistent-template-2.5.4.tar.gz persistent-template.cabal New: ---- persistent-template-2.6.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-persistent-template.spec ++++++ --- /var/tmp/diff_new_pack.gi0DN0/_old 2019-02-17 12:20:24.460215959 +0100 +++ /var/tmp/diff_new_pack.gi0DN0/_new 2019-02-17 12:20:24.468215956 +0100 @@ -1,7 +1,7 @@ # # spec file for package ghc-persistent-template # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,14 +19,13 @@ %global pkg_name persistent-template %bcond_with tests Name: ghc-%{pkg_name} -Version: 2.5.4 +Version: 2.6.0 Release: 0 Summary: Type-safe, non-relational, multi-backend persistence License: MIT Group: Development/Libraries/Haskell 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/3.cabal#/%{pkg_name}.cabal BuildRequires: ghc-Cabal-devel BuildRequires: ghc-aeson-compat-devel BuildRequires: ghc-aeson-devel @@ -66,7 +65,6 @@ %prep %setup -q -n %{pkg_name}-%{version} -cp -p %{SOURCE1} %{pkg_name}.cabal %build %ghc_lib_build ++++++ persistent-template-2.5.4.tar.gz -> persistent-template-2.6.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/persistent-template-2.5.4/ChangeLog.md new/persistent-template-2.6.0/ChangeLog.md --- old/persistent-template-2.5.4/ChangeLog.md 2018-03-08 16:56:53.000000000 +0100 +++ new/persistent-template-2.6.0/ChangeLog.md 2019-01-27 14:37:47.000000000 +0100 @@ -1,3 +1,7 @@ +## 2.6.0 +* [persistent#846](https://github.com/yesodweb/persistent/pull/846): Improve error message when marshalling fails +* [persistent#826](https://github.com/yesodweb/persistent/pull/826): Change `Unique` derive `Show` + ## 2.5.4 * [persistent#778](https://github.com/yesodweb/persistent/issues/778): Add `persistManyFileWith`. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/persistent-template-2.5.4/Database/Persist/TH.hs new/persistent-template-2.6.0/Database/Persist/TH.hs --- old/persistent-template-2.5.4/Database/Persist/TH.hs 2018-03-08 16:56:53.000000000 +0100 +++ new/persistent-template-2.6.0/Database/Persist/TH.hs 2019-01-27 14:37:47.000000000 +0100 @@ -524,7 +524,16 @@ Nothing #endif (map (mkUnique mps t) $ entityUniques t) - [] + (derivClause $ entityUniques t) + where + derivClause [] = [] +#if MIN_VERSION_template_haskell(2,12,0) + derivClause _ = [DerivClause Nothing [ConT ''Show]] +#elif MIN_VERSION_template_haskell(2,11,0) + derivClause _ = [ConT ''Show] +#else + derivClause _ = [''Show] +#endif mkUnique :: MkPersistSettings -> EntityDef -> UniqueDef -> Con mkUnique mps t (UniqueDef (HaskellName constr) _ fields attrs) = @@ -665,9 +674,6 @@ mapLeft _ (Right r) = Right r mapLeft f (Left l) = Left (f l) -fieldError :: Text -> Text -> Text -fieldError fieldName err = "Couldn't parse field `" `mappend` fieldName `mappend` "` from database results: " `mappend` err - mkFromPersistValues :: MkPersistSettings -> EntityDef -> Q [Clause] mkFromPersistValues _ t@(EntityDef { entitySum = False }) = fromValues t "fromPersistValues" entE $ entityFields t @@ -971,37 +977,53 @@ headNote xs = error $ "mkKeyFromValues: expected a list of one element, got: " `mappend` show xs - fromValues :: EntityDef -> Text -> Exp -> [FieldDef] -> Q [Clause] fromValues t funName conE fields = do - x <- newName "x" - let funMsg = entityText t `mappend` ": " `mappend` funName `mappend` " failed on: " - patternMatchFailure <- - [|Left $ mappend funMsg (pack $ show $(return $ VarE x))|] - suc <- patternSuccess fields - return [ suc, normalClause [VarP x] patternMatchFailure ] - where - patternSuccess [] = do - rightE <- [|Right|] - return $ normalClause [ListP []] (rightE `AppE` conE) - patternSuccess fieldsNE = do - x1 <- newName "x1" - restNames <- mapM (\i -> newName $ "x" `mappend` show i) [2..length fieldsNE] - (fpv1:mkPersistValues) <- mapM mkPvFromFd fieldsNE - app1E <- [|(<$>)|] - let conApp = infixFromPersistValue app1E fpv1 conE x1 - applyE <- [|(A.<*>)|] - let applyFromPersistValue = infixFromPersistValue applyE - - return $ normalClause - [ListP $ map VarP (x1:restNames)] - (foldl' (\exp (name, fpv) -> applyFromPersistValue fpv exp name) conApp (zip restNames mkPersistValues)) - where - infixFromPersistValue applyE fpv exp name = - UInfixE exp applyE (fpv `AppE` VarE name) - mkPvFromFd = mkPersistValue . unHaskellName . fieldHaskell - mkPersistValue fieldName = [|mapLeft (fieldError fieldName) . fromPersistValue|] + x <- newName "x" + let funMsg = entityText t `mappend` ": " `mappend` funName `mappend` " failed on: " + patternMatchFailure <- [|Left $ mappend funMsg (pack $ show $(return $ VarE x))|] + suc <- patternSuccess + return [ suc, normalClause [VarP x] patternMatchFailure ] + where + patternSuccess = + case fields of + [] -> do + rightE <- [|Right|] + return $ normalClause [ListP []] (rightE `AppE` conE) + _ -> do + x1 <- newName "x1" + restNames <- mapM (\i -> newName $ "x" `mappend` show i) [2..length fields] + (fpv1:mkPersistValues) <- mapM mkPersistValue fields + app1E <- [|(<$>)|] + let conApp = infixFromPersistValue app1E fpv1 conE x1 + applyE <- [|(A.<*>)|] + let applyFromPersistValue = infixFromPersistValue applyE + + return $ normalClause + [ListP $ map VarP (x1:restNames)] + (foldl' (\exp (name, fpv) -> applyFromPersistValue fpv exp name) conApp (zip restNames mkPersistValues)) + + infixFromPersistValue applyE fpv exp name = + UInfixE exp applyE (fpv `AppE` VarE name) + + mkPersistValue field = + [|mapLeft (fieldError t field) . fromPersistValue|] + +fieldError :: EntityDef -> FieldDef -> Text -> Text +fieldError entity field err = mconcat + [ "Couldn't parse field `" + , fieldName + , "` from table `" + , tableName + , "`. " + , err + ] + where + fieldName = + unHaskellName (fieldHaskell field) + tableName = + unDBName (entityDB entity) mkEntity :: EntityMap -> MkPersistSettings -> EntityDef -> Q [Dec] mkEntity entMap mps t = do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/persistent-template-2.5.4/persistent-template.cabal new/persistent-template-2.6.0/persistent-template.cabal --- old/persistent-template-2.5.4/persistent-template.cabal 2018-03-08 16:56:53.000000000 +0100 +++ new/persistent-template-2.6.0/persistent-template.cabal 2018-12-30 02:20:10.000000000 +0100 @@ -1,5 +1,5 @@ name: persistent-template -version: 2.5.4 +version: 2.6.0 license: MIT license-file: LICENSE author: Michael Snoyman <mich...@snoyman.com> @@ -23,13 +23,13 @@ , text >= 0.5 , transformers >= 0.2 && < 0.6 , containers - , aeson >= 0.7 && < 1.3 + , aeson >= 0.7 && < 1.5 , aeson-compat >= 0.3.2.0 && < 0.4 , monad-logger , unordered-containers , tagged , path-pieces - , http-api-data >= 0.2 && < 0.4 + , http-api-data >= 0.2 , ghc-prim exposed-modules: Database.Persist.TH ghc-options: -Wall diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/persistent-template-2.5.4/test/main.hs new/persistent-template-2.6.0/test/main.hs --- old/persistent-template-2.5.4/test/main.hs 2017-10-10 21:55:55.000000000 +0200 +++ new/persistent-template-2.6.0/test/main.hs 2018-07-15 06:56:03.000000000 +0200 @@ -50,14 +50,6 @@ deriving Show Eq |] -share [mkPersist sqlSettings { mpsGeneric = True , mpsGenerateLenses = True }] [persistLowerCase| -Foo - bar Text Maybe - baz BazId -Baz - bin Int -|] - arbitraryT :: Gen Text arbitraryT = pack A.<$> arbitrary