File 0002-Fix-warnings-for-persistent-2.6.patch of Package ghc-esqueleto
From f19f5f1ec7feda7925880754511e316beab97979 Mon Sep 17 00:00:00 2001
From: Echo Nolan <echo@echonolan.net>
Date: Fri, 2 Sep 2016 11:53:24 -0700
Subject: [PATCH 2/2] Fix warnings for persistent-2.6
---
esqueleto.cabal | 2 ++
src/Database/Esqueleto.hs | 2 +-
src/Database/Esqueleto/Internal/Language.hs | 2 +-
src/Database/Esqueleto/Internal/Sql.hs | 6 +++---
test/Test.hs | 2 +-
5 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/esqueleto.cabal b/esqueleto.cabal
index dc75dfd..24796d0 100644
--- a/esqueleto.cabal
+++ b/esqueleto.cabal
@@ -77,6 +77,8 @@ library
, resourcet >= 1.1
, blaze-html
hs-source-dirs: src/
+ if impl(ghc >= 8.0.1)
+ ghc-options: -Wall -Wno-redundant-constraints
ghc-options: -Wall
test-suite test
diff --git a/src/Database/Esqueleto.hs b/src/Database/Esqueleto.hs
index d9ab78a..3744af9 100644
--- a/src/Database/Esqueleto.hs
+++ b/src/Database/Esqueleto.hs
@@ -405,7 +405,7 @@ import qualified Database.Persist
-- | @valkey i = 'val' . 'toSqlKey'@
-- (<https://github.com/prowdsponsor/esqueleto/issues/9>).
-valkey :: (Esqueleto query expr backend, ToBackendKey SqlBackend entity, PersistField (Key entity)) =>
+valkey :: (Esqueleto query expr backend, ToBackendKey SqlBackend entity) =>
Int64 -> expr (Value (Key entity))
valkey = val . toSqlKey
diff --git a/src/Database/Esqueleto/Internal/Language.hs b/src/Database/Esqueleto/Internal/Language.hs
index fbe88e2..60a6bd8 100644
--- a/src/Database/Esqueleto/Internal/Language.hs
+++ b/src/Database/Esqueleto/Internal/Language.hs
@@ -299,7 +299,7 @@ class (Functor query, Applicative query, Monad query) =>
sub_selectDistinct :: PersistField a => query (expr (Value a)) -> expr (Value a)
-- | Project a field of an entity.
- (^.) :: (PersistEntity val, PersistField typ) =>
+ (^.) :: (PersistEntity val) =>
expr (Entity val) -> EntityField val typ -> expr (Value typ)
-- | Project a field of an entity that may be null.
diff --git a/src/Database/Esqueleto/Internal/Sql.hs b/src/Database/Esqueleto/Internal/Sql.hs
index 32db5d9..b070b81 100644
--- a/src/Database/Esqueleto/Internal/Sql.hs
+++ b/src/Database/Esqueleto/Internal/Sql.hs
@@ -421,7 +421,7 @@ instance Esqueleto SqlQuery SqlExpr SqlBackend where
sub_select = sub SELECT
sub_selectDistinct = sub_select . distinct
- (^.) :: forall val typ. (PersistEntity val, PersistField typ)
+ (^.) :: forall val typ. (PersistEntity val)
=> SqlExpr (Entity val) -> EntityField val typ -> SqlExpr (Value typ)
EEntity ident ^. field
| isComposite = ECompositeKey $ \info -> dot info <$> compositeFields pdef
@@ -530,12 +530,12 @@ instance Esqueleto SqlQuery SqlExpr SqlBackend where
instance ToSomeValues SqlExpr (SqlExpr (Value a)) where
toSomeValues a = [SomeValue a]
-fieldName :: (PersistEntity val, PersistField typ)
+fieldName :: (PersistEntity val)
=> IdentInfo -> EntityField val typ -> TLB.Builder
fieldName info = fromDBName info . fieldDB . persistFieldDef
-- FIXME: Composite/non-id pKS not supported on set
-setAux :: (PersistEntity val, PersistField typ)
+setAux :: (PersistEntity val)
=> EntityField val typ
-> (SqlExpr (Entity val) -> SqlExpr (Value typ))
-> SqlExpr (Update val)
diff --git a/test/Test.hs b/test/Test.hs
index 48650b3..9d82ad5 100644
--- a/test/Test.hs
+++ b/test/Test.hs
@@ -1460,7 +1460,7 @@ withConn :: RunDbMonad m => (SqlBackend -> R.ResourceT m a) -> m a
withConn =
R.runResourceT .
#if defined(WITH_POSTGRESQL)
- withPostgresqlConn "host=localhost port=5432 user=test dbname=test"
+ withPostgresqlConn "host=localhost port=5432 user=test password=test dbname=test"
#elif defined (WITH_MYSQL)
withMySQLConn defaultConnectInfo
{ connectHost = "localhost"
--
2.10.0