From a58a4d88cd8a68d1cfa20d63772f03e572edb734 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Estrella?= Date: Tue, 18 Jul 2017 23:01:04 -0500 Subject: [PATCH 01/12] Add implicit param HasCallStack to assertions --- yesod-test/ChangeLog.md | 4 ++++ yesod-test/Yesod/Test.hs | 40 ++++++++++++++++++++++++------------- yesod-test/yesod-test.cabal | 2 +- 3 files changed, 31 insertions(+), 15 deletions(-) diff --git a/yesod-test/ChangeLog.md b/yesod-test/ChangeLog.md index 2c1330d4..41acb0c8 100644 --- a/yesod-test/ChangeLog.md +++ b/yesod-test/ChangeLog.md @@ -1,3 +1,7 @@ +## 1.5.8 +* Added implicit parameter HasCallStack to assertions. +[#1421](https://github.com/yesodweb/yesod/pull/1421) + ## 1.5.7 * Add clickOn. diff --git a/yesod-test/Yesod/Test.hs b/yesod-test/Yesod/Test.hs index 6ef3c684..06e1fa67 100644 --- a/yesod-test/Yesod/Test.hs +++ b/yesod-test/Yesod/Test.hs @@ -4,6 +4,8 @@ {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE ImplicitParams #-} +{-# LANGUAGE ConstraintKinds #-} {-| Yesod.Test is a pragmatic framework for testing web applications built @@ -150,6 +152,16 @@ import Data.Time.Clock (getCurrentTime) import Control.Applicative ((<$>)) import Text.Show.Pretty (ppShow) import Data.Monoid (mempty) +#if MIN_VERSION_base(4,9,0) +import GHC.Stack (HasCallStack) +#elif MIN_VERSION_base(4,8,1) +import GHC.Stack (CallStack) +type HasCallStack = (?callStack :: CallStack) +#else +import GHC.Exts (Constraint) +type HasCallStack = (() :: Constraint) +#endif + -- | The state used in a single test case defined using 'yit' -- @@ -330,7 +342,7 @@ htmlQuery = htmlQuery' yedResponse [] -- In case they are not equal, error mesasge includes the two values. -- -- @since 1.5.2 -assertEq :: (Eq a, Show a) => String -> a -> a -> YesodExample site () +assertEq :: (HasCallStack, Eq a, Show a) => String -> a -> a -> YesodExample site () assertEq m a b = liftIO $ HUnit.assertBool msg (a == b) where msg = "Assertion: " ++ m ++ "\n" ++ @@ -342,24 +354,24 @@ assertEq m a b = -- In case they are equal, error mesasge includes the values. -- -- @since 1.5.6 -assertNotEq :: (Eq a, Show a) => String -> a -> a -> YesodExample site () +assertNotEq :: (HasCallStack, Eq a, Show a) => String -> a -> a -> YesodExample site () assertNotEq m a b = liftIO $ HUnit.assertBool msg (a /= b) where msg = "Assertion: " ++ m ++ "\n" ++ "Both arguments: " ++ ppShow a ++ "\n" {-# DEPRECATED assertEqual "Use assertEq instead" #-} -assertEqual :: (Eq a) => String -> a -> a -> YesodExample site () +assertEqual :: (HasCallStack, Eq a) => String -> a -> a -> YesodExample site () assertEqual = assertEqualNoShow -- | Asserts that the two given values are equal. -- -- @since 1.5.2 -assertEqualNoShow :: (Eq a) => String -> a -> a -> YesodExample site () +assertEqualNoShow :: (HasCallStack, Eq a) => String -> a -> a -> YesodExample site () assertEqualNoShow msg a b = liftIO $ HUnit.assertBool msg (a == b) -- | Assert the last response status is as expected. -statusIs :: Int -> YesodExample site () +statusIs :: HasCallStack => Int -> YesodExample site () statusIs number = withResponse $ \ SResponse { simpleStatus = s } -> liftIO $ flip HUnit.assertBool (H.statusCode s == number) $ concat [ "Expected status was ", show number @@ -367,7 +379,7 @@ statusIs number = withResponse $ \ SResponse { simpleStatus = s } -> ] -- | Assert the given header key/value pair was returned. -assertHeader :: CI BS8.ByteString -> BS8.ByteString -> YesodExample site () +assertHeader :: HasCallStack => CI BS8.ByteString -> BS8.ByteString -> YesodExample site () assertHeader header value = withResponse $ \ SResponse { simpleHeaders = h } -> case lookup header h of Nothing -> failure $ T.pack $ concat @@ -387,7 +399,7 @@ assertHeader header value = withResponse $ \ SResponse { simpleHeaders = h } -> ] -- | Assert the given header was not included in the response. -assertNoHeader :: CI BS8.ByteString -> YesodExample site () +assertNoHeader :: HasCallStack => CI BS8.ByteString -> YesodExample site () assertNoHeader header = withResponse $ \ SResponse { simpleHeaders = h } -> case lookup header h of Nothing -> return () @@ -400,14 +412,14 @@ assertNoHeader header = withResponse $ \ SResponse { simpleHeaders = h } -> -- | Assert the last response is exactly equal to the given text. This is -- useful for testing API responses. -bodyEquals :: String -> YesodExample site () +bodyEquals :: HasCallStack => String -> YesodExample site () bodyEquals text = withResponse $ \ res -> liftIO $ HUnit.assertBool ("Expected body to equal " ++ text) $ (simpleBody res) == encodeUtf8 (TL.pack text) -- | Assert the last response has the given text. The check is performed using the response -- body in full text form. -bodyContains :: String -> YesodExample site () +bodyContains :: HasCallStack => String -> YesodExample site () bodyContains text = withResponse $ \ res -> liftIO $ HUnit.assertBool ("Expected body to contain " ++ text) $ (simpleBody res) `contains` text @@ -415,7 +427,7 @@ bodyContains text = withResponse $ \ res -> -- | Assert the last response doesn't have the given text. The check is performed using the response -- body in full text form. -- @since 1.5.3 -bodyNotContains :: String -> YesodExample site () +bodyNotContains :: HasCallStack => String -> YesodExample site () bodyNotContains text = withResponse $ \ res -> liftIO $ HUnit.assertBool ("Expected body not to contain " ++ text) $ not $ contains (simpleBody res) text @@ -425,7 +437,7 @@ contains a b = DL.isInfixOf b (TL.unpack $ decodeUtf8 a) -- | Queries the HTML using a CSS selector, and all matched elements must contain -- the given string. -htmlAllContain :: Query -> String -> YesodExample site () +htmlAllContain :: HasCallStack => Query -> String -> YesodExample site () htmlAllContain query search = do matches <- htmlQuery query case matches of @@ -437,7 +449,7 @@ htmlAllContain query search = do -- element contains the given string. -- -- Since 0.3.5 -htmlAnyContain :: Query -> String -> YesodExample site () +htmlAnyContain :: HasCallStack => Query -> String -> YesodExample site () htmlAnyContain query search = do matches <- htmlQuery query case matches of @@ -450,7 +462,7 @@ htmlAnyContain query search = do -- inverse of htmlAnyContains). -- -- Since 1.2.2 -htmlNoneContain :: Query -> String -> YesodExample site () +htmlNoneContain :: HasCallStack => Query -> String -> YesodExample site () htmlNoneContain query search = do matches <- htmlQuery query case DL.filter (DL.isInfixOf search) (map (TL.unpack . decodeUtf8) matches) of @@ -460,7 +472,7 @@ htmlNoneContain query search = do -- | Performs a CSS query on the last response and asserts the matched elements -- are as many as expected. -htmlCount :: Query -> Int -> YesodExample site () +htmlCount :: HasCallStack => Query -> Int -> YesodExample site () htmlCount query count = do matches <- fmap DL.length $ htmlQuery query liftIO $ flip HUnit.assertBool (matches == count) diff --git a/yesod-test/yesod-test.cabal b/yesod-test/yesod-test.cabal index 8e834f10..528ee130 100644 --- a/yesod-test/yesod-test.cabal +++ b/yesod-test/yesod-test.cabal @@ -1,5 +1,5 @@ name: yesod-test -version: 1.5.7 +version: 1.5.8 license: MIT license-file: LICENSE author: Nubis From 06ca675bb6783b740f84082d3d965ebfa6bf0f41 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Thu, 20 Jul 2017 13:58:15 +0300 Subject: [PATCH 02/12] Version bump --- yesod-core/ChangeLog.md | 4 ++++ yesod-core/yesod-core.cabal | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/yesod-core/ChangeLog.md b/yesod-core/ChangeLog.md index 3904cfa9..9673ee14 100644 --- a/yesod-core/ChangeLog.md +++ b/yesod-core/ChangeLog.md @@ -1,3 +1,7 @@ +## 1.4.35.1 + +* TH fix for GHC 8.2 + ## 1.4.35 * Contexts can be included in generated TH instances. [1365](https://github.com/yesodweb/yesod/issues/1365) diff --git a/yesod-core/yesod-core.cabal b/yesod-core/yesod-core.cabal index ae9569f3..1f058c5d 100644 --- a/yesod-core/yesod-core.cabal +++ b/yesod-core/yesod-core.cabal @@ -1,5 +1,5 @@ name: yesod-core -version: 1.4.35 +version: 1.4.35.1 license: MIT license-file: LICENSE author: Michael Snoyman From 087f4d20923e822529f2a21673d434207f5ce9f5 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 22 Jul 2017 22:58:23 -0400 Subject: [PATCH 03/12] Convert yesod-static to cryptonite. --- stack.yaml | 1 + yesod-static/Yesod/Static.hs | 6 +++--- yesod-static/yesod-static.cabal | 10 ++++++---- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/stack.yaml b/stack.yaml index 57a79fa9..91401c44 100644 --- a/stack.yaml +++ b/stack.yaml @@ -24,6 +24,7 @@ extra-deps: - persistent-sqlite-2.5 - cookie-0.4.2 - cryptonite-0.23 +- cryptonite-conduit-0.2.0 - foundation-0.0.9 - memory-0.14.5 - hfsevents-0.1.6 diff --git a/yesod-static/Yesod/Static.hs b/yesod-static/Yesod/Static.hs index 4d8d368e..636bd333 100644 --- a/yesod-static/Yesod/Static.hs +++ b/yesod-static/Yesod/Static.hs @@ -81,7 +81,7 @@ import Crypto.Hash (MD5, Digest) import Control.Monad.Catch (MonadThrow) import Control.Monad.Trans.State -import qualified Data.Byteable as Byteable +import qualified Data.ByteArray as ByteArray import qualified Data.ByteString.Base64 import qualified Data.ByteString.Char8 as S8 import qualified Data.ByteString.Lazy as L @@ -420,7 +420,7 @@ mkStaticFilesList' fp fs makeHash = do base64md5File :: FilePath -> IO String base64md5File = fmap (base64 . encode) . hashFile - where encode d = Byteable.toBytes (d :: Digest MD5) + where encode d = ByteArray.convert (d :: Digest MD5) base64md5 :: L.ByteString -> String base64md5 lbs = @@ -428,7 +428,7 @@ base64md5 lbs = $ runIdentity $ sourceList (L.toChunks lbs) $$ sinkHash where - encode d = Byteable.toBytes (d :: Digest MD5) + encode d = ByteArray.convert (d :: Digest MD5) base64 :: S.ByteString -> String base64 = map tr diff --git a/yesod-static/yesod-static.cabal b/yesod-static/yesod-static.cabal index 9fe49537..ff266c0e 100644 --- a/yesod-static/yesod-static.cabal +++ b/yesod-static/yesod-static.cabal @@ -44,8 +44,9 @@ library , unix-compat >= 0.2 , conduit >= 0.5 , conduit-extra - , cryptohash-conduit >= 0.1 - , cryptohash >= 0.11 + , cryptonite-conduit >= 0.1 + , cryptonite >= 0.11 + , memory , data-default , mime-types >= 0.1 , hjsmin @@ -112,8 +113,9 @@ test-suite tests , http-types , unix-compat , conduit - , cryptohash-conduit - , cryptohash + , cryptonite-conduit + , cryptonite + , memory , data-default , mime-types , hjsmin From 42112add3cd06f9a707dc31866b66c194729b976 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Sun, 23 Jul 2017 07:27:14 +0300 Subject: [PATCH 04/12] Version bump --- yesod-static/ChangeLog.md | 4 ++++ yesod-static/yesod-static.cabal | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/yesod-static/ChangeLog.md b/yesod-static/ChangeLog.md index 7afd4396..fdb162a8 100644 --- a/yesod-static/ChangeLog.md +++ b/yesod-static/ChangeLog.md @@ -1,3 +1,7 @@ +## 1.5.3.1 + +* Switch to cryptonite + ## 1.5.3 * Add `staticFilesMap` function diff --git a/yesod-static/yesod-static.cabal b/yesod-static/yesod-static.cabal index ff266c0e..2a9c8506 100644 --- a/yesod-static/yesod-static.cabal +++ b/yesod-static/yesod-static.cabal @@ -1,5 +1,5 @@ name: yesod-static -version: 1.5.3 +version: 1.5.3.1 license: MIT license-file: LICENSE author: Michael Snoyman From fefe8e0219799730bd6ceb3923f0448317102dbd Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Sun, 23 Jul 2017 09:34:15 +0300 Subject: [PATCH 05/12] Attempt to get Travis building again --- .travis.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.travis.yml b/.travis.yml index ee1a40b9..480d440f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -119,6 +119,8 @@ matrix: allow_failures: - env: BUILD=cabal GHCVER=head CABALVER=head HAPPYVER=1.19.5 ALEXVER=3.1.7 - env: BUILD=stack ARGS="--resolver nightly" + - env: BUILD=cabal GHCVER=7.8.4 CABALVER=1.18 HAPPYVER=1.19.5 ALEXVER=3.1.7 + - env: BUILD=cabal GHCVER=7.10.3 CABALVER=1.22 HAPPYVER=1.19.5 ALEXVER=3.1.7 before_install: # Using compiler above sets CC to an invalid value, so unset it @@ -171,9 +173,15 @@ script: # Build dependencies with -O0 as well echo "apply-ghc-options: everything" >> stack.yaml + # Avoid OOM for building Cabal + stack --install-ghc --no-terminal $ARGS build Cabal --fast + # Use slightly less intensive options on OS X due to Travis timeouts stack --install-ghc --no-terminal $ARGS test --fast else + # Avoid OOM for building Cabal + stack --install-ghc --no-terminal $ARGS build Cabal --fast + stack --install-ghc --no-terminal $ARGS test --bench --no-run-benchmarks --haddock --no-haddock-deps --pedantic fi ;; From 8e367bda3d53b6c4ae342fc2183ce7fb9c0707ac Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Sun, 23 Jul 2017 10:31:51 +0300 Subject: [PATCH 06/12] Bump to LTS 8 --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 480d440f..01050e7f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -81,8 +81,8 @@ matrix: compiler: ": #stack 7.10.3" addons: {apt: {packages: [libgmp-dev]}} - - env: BUILD=stack ARGS="--resolver lts-7" - compiler: ": #stack 8.0.1" + - env: BUILD=stack ARGS="--resolver lts-8" + compiler: ": #stack 8.0.2" addons: {apt: {packages: [libgmp-dev]}} # Nightly builds are allowed to fail @@ -108,8 +108,8 @@ matrix: compiler: ": #stack 7.10.3 osx" os: osx - - env: BUILD=stack ARGS="--resolver lts-7" - compiler: ": #stack 8.0.1 osx" + - env: BUILD=stack ARGS="--resolver lts-8" + compiler: ": #stack 8.0.2 osx" os: osx - env: BUILD=stack ARGS="--resolver nightly" From 626719ce285d91386141902b48174fecf7bcb9f0 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Sun, 23 Jul 2017 11:10:47 +0300 Subject: [PATCH 07/12] Fix some version issues --- stack.yaml | 4 ++-- yesod-auth-oauth/yesod-auth-oauth.cabal | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/stack.yaml b/stack.yaml index 91401c44..74ce3c0c 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,4 +1,4 @@ -resolver: lts-6.23 +resolver: lts-8.12 packages: - ./yesod-core - ./yesod-static @@ -16,7 +16,7 @@ packages: # Needed for LTS 2 extra-deps: -- wai-app-static-3.1.4.1 +- wai-app-static-3.1.6.1 - http-api-data-0.2 - yaml-0.8.17 - nonce-1.0.2 diff --git a/yesod-auth-oauth/yesod-auth-oauth.cabal b/yesod-auth-oauth/yesod-auth-oauth.cabal index 34a5a1f6..c21ac9e1 100644 --- a/yesod-auth-oauth/yesod-auth-oauth.cabal +++ b/yesod-auth-oauth/yesod-auth-oauth.cabal @@ -21,7 +21,7 @@ library cpp-options: -DGHC7 else build-depends: base >= 4 && < 4.3 - build-depends: authenticate-oauth >= 1.5 && < 1.6 + build-depends: authenticate-oauth >= 1.5 && < 1.7 , bytestring >= 0.9.1.4 , yesod-core >= 1.4 && < 1.5 , yesod-auth >= 1.4 && < 1.5 From 4b34fe9c72c064699af13619153c04c4c8dab343 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Sun, 23 Jul 2017 12:25:23 +0300 Subject: [PATCH 08/12] Fix deprecation warning for LTS 8 --- yesod-auth/Yesod/Auth/GoogleEmail2.hs | 4 ++++ yesod-core/Yesod/Core/Content.hs | 10 +++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/yesod-auth/Yesod/Auth/GoogleEmail2.hs b/yesod-auth/Yesod/Auth/GoogleEmail2.hs index 57db613e..577e86a7 100644 --- a/yesod-auth/Yesod/Auth/GoogleEmail2.hs +++ b/yesod-auth/Yesod/Auth/GoogleEmail2.hs @@ -74,7 +74,11 @@ import Control.Monad.IO.Class (MonadIO) import qualified Crypto.Nonce as Nonce import Data.Aeson ((.:?)) import qualified Data.Aeson as A +#if MIN_VERSION_aeson(1,0,0) +import qualified Data.Aeson.Text as A +#else import qualified Data.Aeson.Encode as A +#endif import Data.Aeson.Parser (json') import Data.Aeson.Types (FromJSON (parseJSON), parseEither, parseMaybe, withObject, withText) diff --git a/yesod-core/Yesod/Core/Content.hs b/yesod-core/Yesod/Core/Content.hs index faab94ce..1313a1ea 100644 --- a/yesod-core/Yesod/Core/Content.hs +++ b/yesod-core/Yesod/Core/Content.hs @@ -66,7 +66,8 @@ import Data.Conduit.Internal (ResumableSource (ResumableSource)) import qualified Data.Conduit.Internal as CI import qualified Data.Aeson as J -#if MIN_VERSION_aeson(0, 7, 0) +#if MIN_VERSION_aeson(1, 0, 0) +#elif MIN_VERSION_aeson(0, 7, 0) import Data.Aeson.Encode (encodeToTextBuilder) #else import Data.Aeson.Encode (fromValue) @@ -242,6 +243,11 @@ instance ToContent a => ToContent (DontFullyEvaluate a) where toContent (DontFullyEvaluate a) = ContentDontEvaluate $ toContent a instance ToContent J.Value where +#if MIN_VERSION_aeson(1, 0, 0) + toContent = flip ContentBuilder Nothing + . J.fromEncoding + . J.toEncoding +#else toContent = flip ContentBuilder Nothing . Blaze.fromLazyText . toLazyText @@ -251,6 +257,8 @@ instance ToContent J.Value where . fromValue #endif +#endif + #if MIN_VERSION_aeson(0, 11, 0) instance ToContent J.Encoding where toContent = flip ContentBuilder Nothing . J.fromEncoding From fff8f8ff5f5f05ebf0b69274cff17fb3a4e51a56 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Sun, 23 Jul 2017 13:04:40 +0300 Subject: [PATCH 09/12] Reduce extra-deps, drop LTS 2 and 3 --- .travis.yml | 17 ----------------- stack.yaml | 32 -------------------------------- 2 files changed, 49 deletions(-) diff --git a/.travis.yml b/.travis.yml index 01050e7f..ab790d0b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -69,14 +69,6 @@ matrix: compiler: ": #stack default" addons: {apt: {packages: [libgmp-dev]}} - - env: BUILD=stack ARGS="--resolver lts-2" - compiler: ": #stack 7.8.4" - addons: {apt: {packages: [libgmp-dev]}} - - - env: BUILD=stack ARGS="--resolver lts-3" - compiler: ": #stack 7.10.2" - addons: {apt: {packages: [libgmp-dev]}} - - env: BUILD=stack ARGS="--resolver lts-6" compiler: ": #stack 7.10.3" addons: {apt: {packages: [libgmp-dev]}} @@ -95,15 +87,6 @@ matrix: compiler: ": #stack default osx" os: osx - # Travis includes an OS X which is incompatible with GHC 7.8.4 - #- env: BUILD=stack ARGS="--resolver lts-2" - # compiler: ": #stack 7.8.4 osx" - # os: osx - - - env: BUILD=stack ARGS="--resolver lts-3" - compiler: ": #stack 7.10.2 osx" - os: osx - - env: BUILD=stack ARGS="--resolver lts-6" compiler: ": #stack 7.10.3 osx" os: osx diff --git a/stack.yaml b/stack.yaml index 74ce3c0c..213e9db3 100644 --- a/stack.yaml +++ b/stack.yaml @@ -13,35 +13,3 @@ packages: - ./yesod - ./yesod-eventsource - ./yesod-websockets - -# Needed for LTS 2 -extra-deps: -- wai-app-static-3.1.6.1 -- http-api-data-0.2 -- yaml-0.8.17 -- nonce-1.0.2 -- persistent-2.5 -- persistent-sqlite-2.5 -- cookie-0.4.2 -- cryptonite-0.23 -- cryptonite-conduit-0.2.0 -- foundation-0.0.9 -- memory-0.14.5 -- hfsevents-0.1.6 -- x509-1.6.5 -- x509-store-1.6.2 -- x509-system-1.6.4 -- x509-validation-1.6.5 -- tls-1.3.8 -- Win32-notify-0.3.0.1 -- asn1-parse-0.9.4 -- asn1-types-0.3.2 -- connection-0.2.8 -- socks-0.5.5 - -- conduit-extra-1.1.14 -- streaming-commons-0.1.16 -- typed-process-0.1.0.0 -- say-0.1.0.0 -- safe-exceptions-0.1.4.0 -- blaze-markup-0.7.1.0 From 5b18bf0c09077019b67b4d6052fb3bccb16ddc7d Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Sun, 23 Jul 2017 16:28:58 +0300 Subject: [PATCH 10/12] Always use solver on Travis --- .travis.yml | 7 ++----- yesod-form/yesod-form.cabal | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index ab790d0b..ee5e3d0b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -139,11 +139,8 @@ install: - if [ -f configure.ac ]; then autoreconf -i; fi - | set -ex - if [ "$ARGS" = "--resolver nightly" ] - then - stack --install-ghc $ARGS build cabal-install - stack --install-ghc $ARGS solver --update-config - fi + stack --install-ghc $ARGS build cabal-install + stack --install-ghc $ARGS solver --update-config set +ex script: diff --git a/yesod-form/yesod-form.cabal b/yesod-form/yesod-form.cabal index 177653d9..7c8d05a1 100644 --- a/yesod-form/yesod-form.cabal +++ b/yesod-form/yesod-form.cabal @@ -24,7 +24,7 @@ library , yesod-persistent >= 1.4 && < 1.5 , time >= 1.1.4 , shakespeare >= 2.0 - , persistent + , persistent >= 2.5 , template-haskell , transformers >= 0.2.2 , data-default From ada76a96361584bce2de4fd091bc39eeeb8bb62a Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Sun, 23 Jul 2017 16:45:47 +0300 Subject: [PATCH 11/12] Revert "Always use solver on Travis" This reverts commit 5b18bf0c09077019b67b4d6052fb3bccb16ddc7d. --- .travis.yml | 7 +++++-- yesod-form/yesod-form.cabal | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index ee5e3d0b..ab790d0b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -139,8 +139,11 @@ install: - if [ -f configure.ac ]; then autoreconf -i; fi - | set -ex - stack --install-ghc $ARGS build cabal-install - stack --install-ghc $ARGS solver --update-config + if [ "$ARGS" = "--resolver nightly" ] + then + stack --install-ghc $ARGS build cabal-install + stack --install-ghc $ARGS solver --update-config + fi set +ex script: diff --git a/yesod-form/yesod-form.cabal b/yesod-form/yesod-form.cabal index 7c8d05a1..177653d9 100644 --- a/yesod-form/yesod-form.cabal +++ b/yesod-form/yesod-form.cabal @@ -24,7 +24,7 @@ library , yesod-persistent >= 1.4 && < 1.5 , time >= 1.1.4 , shakespeare >= 2.0 - , persistent >= 2.5 + , persistent , template-haskell , transformers >= 0.2.2 , data-default From a17779b12d5561c8efe4feadf99b2a412314211a Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Sun, 23 Jul 2017 16:53:12 +0300 Subject: [PATCH 12/12] Fix persistent < 2.5 code --- yesod-form/Yesod/Form/Fields.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yesod-form/Yesod/Form/Fields.hs b/yesod-form/Yesod/Form/Fields.hs index a8a537f0..05b4574d 100644 --- a/yesod-form/Yesod/Form/Fields.hs +++ b/yesod-form/Yesod/Form/Fields.hs @@ -76,7 +76,7 @@ import Database.Persist.Sql (PersistField, PersistFieldSql (..)) #if MIN_VERSION_persistent(2,5,0) import Database.Persist (Entity (..), SqlType (SqlString), PersistRecordBackend, PersistQueryRead) #else -import Database.Persist (Entity (..), SqlType (SqlString)) +import Database.Persist (Entity (..), SqlType (SqlString), PersistEntity, PersistQuery, PersistEntityBackend) #endif import Text.HTML.SanitizeXSS (sanitizeBalance) import Control.Monad (when, unless)