Hello community,
here is the log from the commit of package ghc-persistent-template for
openSUSE:Factory checked in at 2017-04-11 09:43:11
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-persistent-template (Old)
and /work/SRC/openSUSE:Factory/.ghc-persistent-template.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-persistent-template"
Tue Apr 11 09:43:11 2017 rev:9 rq:485154 version:2.5.2
Changes:
--------
---
/work/SRC/openSUSE:Factory/ghc-persistent-template/ghc-persistent-template.changes
2017-03-18 20:50:34.661647699 +0100
+++
/work/SRC/openSUSE:Factory/.ghc-persistent-template.new/ghc-persistent-template.changes
2017-04-11 09:43:15.321251410 +0200
@@ -1,0 +2,5 @@
+Tue Mar 14 09:26:16 UTC 2017 - [email protected]
+
+- Update to version 2.5.2 with cabal2obs.
+
+-------------------------------------------------------------------
Old:
----
persistent-template-2.5.1.6.tar.gz
persistent-template.cabal
New:
----
persistent-template-2.5.2.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-persistent-template.spec ++++++
--- /var/tmp/diff_new_pack.qtun3N/_old 2017-04-11 09:43:15.893170619 +0200
+++ /var/tmp/diff_new_pack.qtun3N/_new 2017-04-11 09:43:15.893170619 +0200
@@ -19,14 +19,13 @@
%global pkg_name persistent-template
%bcond_with tests
Name: ghc-%{pkg_name}
-Version: 2.5.1.6
+Version: 2.5.2
Release: 0
Summary: Type-safe, non-relational, multi-backend persistence
License: MIT
Group: Development/Languages/Other
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-compat-devel
BuildRequires: ghc-aeson-devel
@@ -67,7 +66,6 @@
%prep
%setup -q -n %{pkg_name}-%{version}
-cp -p %{SOURCE1} %{pkg_name}.cabal
%build
%ghc_lib_build
++++++ persistent-template-2.5.1.6.tar.gz -> persistent-template-2.5.2.tar.gz
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/persistent-template-2.5.1.6/ChangeLog.md
new/persistent-template-2.5.2/ChangeLog.md
--- old/persistent-template-2.5.1.6/ChangeLog.md 2016-08-05
07:26:14.000000000 +0200
+++ new/persistent-template-2.5.2/ChangeLog.md 2017-03-01 07:48:55.000000000
+0100
@@ -1,3 +1,8 @@
+## 2.5.2
+
+* Fix incorrect `ToJSON`/`FromJSON` instance generation for generic
+ backends
+
## 2.5.1.6
Allow non-null self-references in a list
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/persistent-template-2.5.1.6/Database/Persist/TH.hs
new/persistent-template-2.5.2/Database/Persist/TH.hs
--- old/persistent-template-2.5.1.6/Database/Persist/TH.hs 2016-08-05
07:23:16.000000000 +0200
+++ new/persistent-template-2.5.2/Database/Persist/TH.hs 2017-03-03
10:45:56.000000000 +0100
@@ -7,9 +7,13 @@
{-# LANGUAGE FlexibleContexts, FlexibleInstances, MultiParamTypeClasses #-}
{-# LANGUAGE UndecidableInstances #-}
{-# OPTIONS_GHC -fno-warn-orphans -fno-warn-missing-fields #-}
+
+#if !MIN_VERSION_base(4,8,0)
-- overlapping instances is for automatic lifting
-- while avoiding an orphan of Lift for Text
{-# LANGUAGE OverlappingInstances #-}
+#endif
+
-- | This module provides utilities for creating backends. Regular users do not
-- need to use this module.
module Database.Persist.TH
@@ -45,7 +49,6 @@
import Prelude hiding ((++), take, concat, splitAt, exp)
import Database.Persist
-import Database.Persist.Class (HasPersistBackend(..), BaseBackend)
import Database.Persist.Sql (Migration, migrate, SqlBackend, PersistFieldSql)
import Database.Persist.Quasi
import Language.Haskell.TH.Lib (
@@ -73,11 +76,11 @@
, Value (Object), (.:), (.:?)
, eitherDecodeStrict'
)
-import Control.Applicative (pure, (<$>), (<*>))
+import Control.Applicative as A (pure, (<$>), (<*>))
import Database.Persist.Sql (sqlType)
import Data.Proxy (Proxy (Proxy))
import Web.PathPieces (PathPiece(..))
-import Web.HttpApiData (ToHttpApiData(..), FromHttpApiData(..),
parseUrlPieceMaybe)
+import Web.HttpApiData (ToHttpApiData(..), FromHttpApiData(..))
import GHC.Generics (Generic)
import qualified Data.Text.Encoding as TE
@@ -246,7 +249,7 @@
Nothing -> NoReference
Just name -> case M.lookup (HaskellName name) allEntities of
Nothing -> NoReference
- Just x -> ForeignRef (HaskellName name)
+ Just _ -> ForeignRef (HaskellName name)
-- This can get corrected in
mkEntityDefSqlTypeExp
(FTTypeCon (Just "Data.Int") "Int64")
Right em -> if embeddedHaskell em /= entName
@@ -256,7 +259,7 @@
else case fieldType field of
FTList _ -> SelfReference
_ -> error $ unpack $ unHaskellName entName
- `mappend` ": a self reference must be a Maybe"
+ `Data.Monoid.mappend` ": a self reference must be a
Maybe"
existing@_ -> existing
}
@@ -281,7 +284,7 @@
Nothing -> SqlTypeExp ft
-- A ForeignRef is blindly set to an Int64 in setEmbedField
-- correct that now
- Just ent -> case entityPrimary ent of
+ Just ent' -> case entityPrimary ent' of
Nothing -> SqlTypeExp ft
Just pdef -> case compositeFields pdef of
[] -> error "mkEntityDefSqlTypeExp: no composite
fields"
@@ -306,7 +309,7 @@
-- 'EntityDef's. Works well with the persist quasi-quoter.
mkPersist :: MkPersistSettings -> [EntityDef] -> Q [Dec]
mkPersist mps ents' = do
- x <- fmap mconcat $ mapM (persistFieldFromEntity mps) ents
+ x <- fmap Data.Monoid.mconcat $ mapM (persistFieldFromEntity mps) ents
y <- fmap mconcat $ mapM (mkEntity entMap mps) ents
z <- fmap mconcat $ mapM (mkJSON mps) ents
return $ mconcat [x, y, z]
@@ -416,7 +419,12 @@
dataTypeDec :: MkPersistSettings -> EntityDef -> Q Dec
dataTypeDec mps t = do
let names = map (mkName . unpack) $ entityDerives t
-#if MIN_VERSION_template_haskell(2,11,0)
+#if MIN_VERSION_template_haskell(2,12,0)
+ DataD [] nameFinal paramsFinal
+ Nothing
+ constrs
+ <$> fmap (pure . DerivClause Nothing) (mapM conT names)
+#elif MIN_VERSION_template_haskell(2,11,0)
DataD [] nameFinal paramsFinal
Nothing
constrs
@@ -718,7 +726,12 @@
bi <- backendKeyI
return (bi, allInstances)
-#if MIN_VERSION_template_haskell(2,11,0)
+#if MIN_VERSION_template_haskell(2,12,0)
+ cxti <- mapM conT i
+ let kd = if useNewtype
+ then NewtypeInstD [] k [recordType] Nothing dec [DerivClause
Nothing cxti]
+ else DataInstD [] k [recordType] Nothing [dec] [DerivClause
Nothing cxti]
+#elif MIN_VERSION_template_haskell(2,11,0)
cxti <- mapM conT i
let kd = if useNewtype
then NewtypeInstD [] k [recordType] Nothing dec cxti
@@ -736,7 +749,7 @@
k = ''Key
recordType = genericDataType mps (entityHaskell t) backendT
pfInstD = -- FIXME: generate a PersistMap instead of PersistList
- [d|instance PersistField (Key $(pure recordType)) where
+ [d|instance PersistField (Key $(A.pure recordType)) where
toPersistValue = PersistList . keyToValues
fromPersistValue (PersistList l) = keyFromValues l
fromPersistValue got = error $ "fromPersistValue: expected
PersistList, got: " `mappend` show got
@@ -874,7 +887,7 @@
mkKeyToValues mps t = do
(p, e) <- case entityPrimary t of
Nothing ->
- ([],) <$> [|(:[]) . toPersistValue . $(return $ unKeyExp t)|]
+ ([],) A.<$> [|(:[]) . toPersistValue . $(return $ unKeyExp t)|]
Just pdef ->
return $ toValuesPrimary pdef
return $ FunD 'keyToValues $ return $ normalClause p e
@@ -924,7 +937,7 @@
(fpv1:mkPersistValues) <- mapM mkPvFromFd fieldsNE
app1E <- [|(<$>)|]
let conApp = infixFromPersistValue app1E fpv1 conE x1
- applyE <- [|(<*>)|]
+ applyE <- [|(A.<*>)|]
let applyFromPersistValue = infixFromPersistValue applyE
return $ normalClause
@@ -1393,7 +1406,7 @@
where
(fieldRef', sqlTyp') = fromMaybe (fieldRef, lift sqlTyp) $
case fieldRef of
- ForeignRef refName ft -> case M.lookup refName entMap of
+ ForeignRef refName _ft -> case M.lookup refName entMap of
Nothing -> Nothing
Just ent ->
case fieldReference $ entityId ent of
@@ -1435,7 +1448,11 @@
lift' m = [|M.fromList $(fmap ListE $ mapM liftPair $ M.toList m)|]
-- auto-lifting, means instances are overlapping
+#if MIN_VERSION_base(4,8,0)
+instance {-# OVERLAPPABLE #-} Lift' a => Lift a where
+#else
instance Lift' a => Lift a where
+#endif
lift = lift'
packPTH :: String -> Text
@@ -1597,9 +1614,9 @@
entityJSONIs <- if mpsGeneric mps
then [d|
#if MIN_VERSION_base(4, 6, 0)
- instance PersistStore backend => ToJSON (Entity $(pure typ))
where
+ instance PersistStore $(pure backendT) => ToJSON (Entity
$(pure typ)) where
toJSON = $(varE (entityToJSON entityJSON))
- instance PersistStore backend => FromJSON (Entity $(pure typ))
where
+ instance PersistStore $(pure backendT) => FromJSON (Entity
$(pure typ)) where
parseJSON = $(varE (entityFromJSON entityJSON))
#endif
|]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/persistent-template-2.5.1.6/persistent-template.cabal
new/persistent-template-2.5.2/persistent-template.cabal
--- old/persistent-template-2.5.1.6/persistent-template.cabal 2016-08-05
07:25:16.000000000 +0200
+++ new/persistent-template-2.5.2/persistent-template.cabal 2017-03-01
07:48:55.000000000 +0100
@@ -1,5 +1,5 @@
name: persistent-template
-version: 2.5.1.6
+version: 2.5.2
license: MIT
license-file: LICENSE
author: Michael Snoyman <[email protected]>
@@ -23,13 +23,13 @@
, text >= 0.5
, transformers >= 0.2 && < 0.6
, containers
- , aeson >= 0.7 && < 0.12
+ , aeson >= 0.7 && < 1.2
, aeson-compat >= 0.3.2.0 && < 0.4
, monad-logger
, unordered-containers
, tagged
, path-pieces
- , http-api-data >= 0.2 && < 0.3
+ , http-api-data >= 0.2 && < 0.4
, 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.1.6/test/main.hs
new/persistent-template-2.5.2/test/main.hs
--- old/persistent-template-2.5.1.6/test/main.hs 2016-07-17
04:15:37.000000000 +0200
+++ new/persistent-template-2.5.2/test/main.hs 2017-03-01 07:48:55.000000000
+0100
@@ -3,16 +3,21 @@
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses #-}
+module Main
+ (
+ -- avoid unused ident warnings
+ module Main
+ ) where
import Test.Hspec
import Test.Hspec.QuickCheck
import Data.ByteString.Lazy.Char8 ()
import Test.QuickCheck.Arbitrary
-import Control.Applicative ((<$>), (<*>), Const (..))
+import Test.QuickCheck.Gen (Gen)
+import Control.Applicative as A ((<$>), (<*>), Const (..))
import Data.Functor.Identity (Identity (..))
import Database.Persist
import Database.Persist.TH
-import Database.Persist.Types (PersistValue(..))
import Data.Text (Text, pack)
import Data.Aeson
@@ -53,10 +58,11 @@
bin Int
|]
-arbitraryT = pack <$> arbitrary
+arbitraryT :: Gen Text
+arbitraryT = pack A.<$> arbitrary
instance Arbitrary Person where
- arbitrary = Person <$> arbitraryT <*> arbitrary <*> arbitrary
+ arbitrary = Person <$> arbitraryT A.<*> arbitrary <*> arbitrary
instance Arbitrary Address where
arbitrary = Address <$> arbitraryT <*> arbitraryT <*> arbitrary
@@ -90,6 +96,7 @@
(person1 ^. (lpersonAddress . laddressCity)) `shouldBe` city1
(person1 & ((lpersonAddress . laddressCity) .~ city2)) `shouldBe`
person2
+(&) :: a -> (a -> b) -> b
x & f = f x
(^.) :: s