From 503739aed235323a6a0823b9c22e15ba44315d58 Mon Sep 17 00:00:00 2001 From: Michael Sloan Date: Tue, 24 May 2016 02:18:19 -0700 Subject: [PATCH] Fix build on GHC 7.8 and GHC 8.0 Unfortunately, this undoes 19a9a6717e7926f36bc4f05dd5a380bb0f71f929 because I got a mysterious assertion failure otherwise (to-be-investigated) --- src/Data/Store/VersionTagged.hs | 2 + src/Stack/Build/Cache.hs | 5 ++- src/Stack/Types/StackT.hs | 9 +++-- src/test/Stack/StoreSpec.hs | 4 +- stack-7.8.yaml | 71 ++++++++++++++++++++++++++++----- stack-8.0.yaml | 3 +- stack.yaml | 6 +-- 7 files changed, 80 insertions(+), 20 deletions(-) diff --git a/src/Data/Store/VersionTagged.hs b/src/Data/Store/VersionTagged.hs index c864d734b0..27763ac472 100644 --- a/src/Data/Store/VersionTagged.hs +++ b/src/Data/Store/VersionTagged.hs @@ -12,6 +12,7 @@ module Data.Store.VersionTagged , decodeFileMaybe ) where +import Control.Applicative import Control.Exception.Lifted (catch, IOException, assert) import Control.Monad.IO.Class (MonadIO, liftIO) import Control.Monad.Logger @@ -23,6 +24,7 @@ import Data.Store.TypeHash import qualified Data.Text as T import Path import Path.IO (ensureDir) +import Prelude -- | Write to the given file, with a binary-tagged tag. taggedEncodeFile :: (Store a, HasTypeHash a, MonadIO m, MonadLogger m, Eq a) diff --git a/src/Stack/Build/Cache.hs b/src/Stack/Build/Cache.hs index 1017bcb6a7..e9b9553c12 100644 --- a/src/Stack/Build/Cache.hs +++ b/src/Stack/Build/Cache.hs @@ -33,10 +33,11 @@ module Stack.Build.Cache import Control.DeepSeq (NFData) import Control.Exception.Enclosed (handleIO, tryAnyDeep) +import Control.Monad (liftM) import Control.Monad.Catch (MonadThrow, MonadCatch) import Control.Monad.IO.Class import Control.Monad.Logger (MonadLogger, logDebug) -import Control.Monad.Reader +import Control.Monad.Reader (MonadReader, asks) import Control.Monad.Trans.Control (MonadBaseControl) import qualified Crypto.Hash.SHA256 as SHA256 import Data.Binary (Binary (..)) @@ -47,6 +48,7 @@ import qualified Data.ByteString.Base16 as B16 import qualified Data.ByteString.Base64.URL as B64URL import qualified Data.ByteString.Char8 as S8 import qualified Data.ByteString.Lazy as LBS +import Data.Foldable (forM_) import Data.Map (Map) import Data.Maybe (fromMaybe, mapMaybe) import Data.Monoid ((<>)) @@ -58,6 +60,7 @@ import Data.Store.TypeHash (HasTypeHash, mkManyHasTypeHash) import Data.Store.VersionTagged import Data.Text (Text) import qualified Data.Text as T +import Data.Traversable (forM) import GHC.Generics (Generic) import Path import Path.IO diff --git a/src/Stack/Types/StackT.hs b/src/Stack/Types/StackT.hs index 9e7558acf3..a77354f515 100644 --- a/src/Stack/Types/StackT.hs +++ b/src/Stack/Types/StackT.hs @@ -229,10 +229,11 @@ stickyLoggerFunc loc src level msg = do getStickyLoggerFunc :: (HasSticky r, HasLogLevel r, HasSupportsUnicode r, ToLogStr msg, MonadReader r m, MonadIO m) => m (Loc -> LogSource -> LogLevel -> msg -> IO ()) -getStickyLoggerFunc = stickyLoggerFuncImpl - <$> asks getSticky - <*> asks getLogLevel - <*> asks getSupportsUnicode +getStickyLoggerFunc = do + sticky <- asks getSticky + logLevel <- asks getLogLevel + supportsUnicode <- asks getSupportsUnicode + return $ stickyLoggerFuncImpl sticky logLevel supportsUnicode stickyLoggerFuncImpl :: ToLogStr msg diff --git a/src/test/Stack/StoreSpec.hs b/src/test/Stack/StoreSpec.hs index facbe160b1..e20d9bfc97 100644 --- a/src/test/Stack/StoreSpec.hs +++ b/src/test/Stack/StoreSpec.hs @@ -7,6 +7,7 @@ {-# LANGUAGE OverloadedStrings #-} module Stack.StoreSpec where +import Control.Applicative import qualified Data.ByteString as BS import Data.Containers (mapFromList, setFromList) import Data.Int @@ -19,11 +20,12 @@ import qualified Data.Vector.Unboxed as UV import Data.Word import Language.Haskell.TH import Language.Haskell.TH.ReifyMany +import Prelude +import Stack.Build.Cache (BuildCache(..)) import Stack.PackageDump import Stack.Types import Test.Hspec import Test.SmallCheck.Series -import Stack.Build.Cache (BuildCache(..)) -- NOTE: these were copied from Data.Store. Should probably be moved to -- smallcheck. diff --git a/stack-7.8.yaml b/stack-7.8.yaml index 782efe87c3..4a8a34f1ac 100644 --- a/stack-7.8.yaml +++ b/stack-7.8.yaml @@ -1,15 +1,66 @@ -resolver: nightly-2016-05-13 -compiler: ghc-7.8.4 +resolver: lts-2.22 +# docker: +# enable: true +# repo: fpco/stack-full +# image: +# containers: +# - base: "fpco/stack-base" # see ./etc/docker/stack-base/Dockerfile +# name: "fpco/stack-test" extra-deps: -- Cabal-1.18.1.7 -- filepath-1.3.0.2 +- path-0.5.7 +- path-io-1.1.0 +- directory-1.2.2.0 +- Win32-notify-0.3.0.1 +- hfsevents-0.1.5 +- project-template-0.2.0 +- filelock-0.1.0.1 +- gitrev-1.2.0 +- http-client-0.4.19 +- http-conduit-2.1.8 +- ignore-0.1.1.0 +- binary-tagged-0.1.3.1 +- fsnotify-0.2.1 +- ansi-terminal-0.6.2.3 +# For deepseq-1.4 +- deepseq-1.4.1.2 +- aeson-0.11.2.0 +- bytestring-0.10.6.0 +- Cabal-1.18.1.6 +- containers-0.5.6.3 +- hpc-0.6.0.2 +- process-1.2.1.0 +- time-1.5.0.1 +- base-compat-0.9.0 - hpack-0.14.0 -- QuickCheck-2.8.2 -- nats-1 +- microlens-0.4.1.0 +- open-browser-0.2.1.0 +- tls-1.3.8 +- cryptonite-0.15 # for tls-1.3.5 +- memory-0.12 +- asn1-parse-0.9.4 +- asn1-types-0.3.2 +- x509-1.6.3 +- x509-validation-1.6.3 +- x509-store-1.6.1 +- x509-system-1.6.3 +- http-client-tls-0.2.4 +- connection-0.2.5 +- regex-applicative-text-0.1.0.1 +- monad-unlift-0.1.1.0 +- attoparsec-0.13.0.2 +- fail-4.9.0.0 +- tagged-0.8.4 +- persistent-template-2.1.8.1 +- aeson-compat-0.3.3.0 +- http-api-data-0.2.2 +- time-locale-compat-0.1.1.1 +- persistent-2.5 +- store-0.1.0.1 - th-reify-many-0.1.6 -- th-utilities-0.1.0.1 -- store-0.1.0.0 +- th-lift-instances-0.1.7 +- th-utilities-0.1.1.0 - th-orphans-0.13.1 +- base-orphans-0.5.4 flags: - QuickCheck: - base4point8: false + time-locale-compat: + old-locale: false \ No newline at end of file diff --git a/stack-8.0.yaml b/stack-8.0.yaml index f10f14117a..4d5ed53d78 100644 --- a/stack-8.0.yaml +++ b/stack-8.0.yaml @@ -37,9 +37,10 @@ extra-deps: - transformers-0.5.2.0 - transformers-compat-0.5.1.4 - unix-2.7.2.0 +- th-lift-instances-0.1.7 - th-reify-many-0.1.6 - th-utilities-0.1.0.1 -- store-0.1.0.0 +- store-0.1.0.1 - th-orphans-0.13.1 packages: - . diff --git a/stack.yaml b/stack.yaml index 9667939dce..983c3dfc38 100644 --- a/stack.yaml +++ b/stack.yaml @@ -14,9 +14,9 @@ nix: extra-deps: - hpack-0.14.0 - path-io-1.1.0 -- th-lift-instances-0.1.6 +- th-lift-instances-0.1.7 - aeson-0.11.2.0 - th-reify-many-0.1.6 -- th-utilities-0.1.0.1 -- store-0.1.0.0 +- th-utilities-0.1.1.0 +- store-0.1.0.1 - th-orphans-0.13.1