From 643725ae369a37f2b3169a7623376f556b21afb9 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Sun, 20 Nov 2016 19:02:25 +0200 Subject: [PATCH] Drop Data.Yaml.Extra #2491 This has been fixed upstream, see: https://github.com/snoyberg/yaml/pull/91 --- src/Data/Yaml/Extra.hs | 27 --------------------------- src/Stack/BuildPlan.hs | 2 +- src/Stack/Config.hs | 2 +- src/Stack/ConfigCmd.hs | 2 +- src/Stack/Solver.hs | 2 +- stack-7.8.yaml | 1 + stack.cabal | 3 +-- 7 files changed, 6 insertions(+), 33 deletions(-) delete mode 100644 src/Data/Yaml/Extra.hs diff --git a/src/Data/Yaml/Extra.hs b/src/Data/Yaml/Extra.hs deleted file mode 100644 index af88d4ef8d..0000000000 --- a/src/Data/Yaml/Extra.hs +++ /dev/null @@ -1,27 +0,0 @@ -{-# LANGUAGE ScopedTypeVariables #-} --- | Wrappers for Yaml functions to workaround --- https://github.com/commercialhaskell/stack/issues/2491. --- Import Data.Yaml.Extra in place of Data.Yaml to use this workaround. --- Beware these functions construct/deconstruct the entire file at once! -module Data.Yaml.Extra (decodeFileEither, encodeFile, module Data.Yaml) where - -import Control.Exception -import Data.Yaml hiding (decodeFileEither, encodeFile) -import qualified Data.ByteString as B -import System.IO - --- Note: we refrain from using 'B.readFile' and 'B.writeFile', as they open --- the file in binary mode rather than text mode. -decodeFileEither :: FromJSON a => FilePath -> IO (Either ParseException a) -decodeFileEither path = - handle (\(e :: IOException) -> return . Left . OtherParseException . SomeException $ e) $ - withFile path ReadMode $ - \hnd -> do - fileContent <- B.hGetContents hnd - return $ decodeEither' fileContent - -encodeFile :: ToJSON a => FilePath -> a -> IO () -encodeFile path v = withFile path WriteMode $ - \hnd -> do - let fileContent = encode v - B.hPut hnd fileContent diff --git a/src/Stack/BuildPlan.hs b/src/Stack/BuildPlan.hs index 34abbb9916..d4aab6da45 100644 --- a/src/Stack/BuildPlan.hs +++ b/src/Stack/BuildPlan.hs @@ -66,7 +66,7 @@ import qualified Data.Text as T import Data.Text.Encoding (encodeUtf8) import qualified Data.Traversable as Tr import Data.Typeable (Typeable) -import Data.Yaml.Extra (decodeEither', decodeFileEither) +import Data.Yaml (decodeEither', decodeFileEither) import qualified Distribution.Package as C import Distribution.PackageDescription (GenericPackageDescription, flagDefault, flagManual, diff --git a/src/Stack/Config.hs b/src/Stack/Config.hs index 899dc3a299..38be572b65 100644 --- a/src/Stack/Config.hs +++ b/src/Stack/Config.hs @@ -64,7 +64,7 @@ import Data.Maybe import Data.Monoid.Extra import qualified Data.Text as T import Data.Text.Encoding (encodeUtf8, decodeUtf8) -import qualified Data.Yaml.Extra as Yaml +import qualified Data.Yaml as Yaml import Distribution.System (OS (..), Platform (..), buildPlatform) import qualified Distribution.Text import Distribution.Version (simplifyVersionRange) diff --git a/src/Stack/ConfigCmd.hs b/src/Stack/ConfigCmd.hs index 2012f56179..bd600d5d73 100644 --- a/src/Stack/ConfigCmd.hs +++ b/src/Stack/ConfigCmd.hs @@ -23,7 +23,7 @@ import qualified Data.HashMap.Strict as HMap import Data.Monoid import Data.Text (Text) import qualified Data.Text as T -import qualified Data.Yaml.Extra as Yaml +import qualified Data.Yaml as Yaml import qualified Options.Applicative as OA import qualified Options.Applicative.Types as OA import Path diff --git a/src/Stack/Solver.hs b/src/Stack/Solver.hs index c28473a5ca..2402d46ece 100644 --- a/src/Stack/Solver.hs +++ b/src/Stack/Solver.hs @@ -54,7 +54,7 @@ import Data.Text.Extra (stripCR) import qualified Data.Text.Lazy as LT import Data.Text.Lazy.Encoding (decodeUtf8With) import Data.Tuple (swap) -import qualified Data.Yaml.Extra as Yaml +import qualified Data.Yaml as Yaml import qualified Distribution.Package as C import qualified Distribution.PackageDescription as C import qualified Distribution.Text as C diff --git a/stack-7.8.yaml b/stack-7.8.yaml index ce5994ca46..03125701d3 100644 --- a/stack-7.8.yaml +++ b/stack-7.8.yaml @@ -76,6 +76,7 @@ extra-deps: - text-metrics-0.1.0 - pid1-0.1.0.0 - file-embed-0.0.10 +- yaml-0.8.20 flags: time-locale-compat: old-locale: false diff --git a/stack.cabal b/stack.cabal index e9f5b432c0..db135efab7 100644 --- a/stack.cabal +++ b/stack.cabal @@ -68,7 +68,6 @@ library Data.Monoid.Extra Data.Store.VersionTagged Data.Text.Extra - Data.Yaml.Extra Distribution.Version.Extra Network.HTTP.Download Network.HTTP.Download.Verified @@ -257,7 +256,7 @@ library , unordered-containers >= 0.2.5.1 , vector >= 0.10.12.3 && < 0.12 , vector-binary-instances - , yaml >= 0.8.10.1 + , yaml >= 0.8.20 , zlib >= 0.5.4.2 && < 0.7 , deepseq >= 1.4 , hastache