stylish-haskell 0.5.10.0 → 0.5.10.1
raw patch · 3 files changed
+25/−13 lines, 3 filesdep ~aesonPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: aeson
API changes (from Hackage documentation)
Files
- CHANGELOG +3/−0
- src/Main.hs +18/−9
- stylish-haskell.cabal +4/−4
CHANGELOG view
@@ -1,3 +1,6 @@+- 0.5.10.1+ * Bump `aeson` dependency to 0.8+ - 0.5.10.0 * Bump `haskell-src-exts` dependency to 1.15 * Fix test which was not run before
src/Main.hs view
@@ -9,10 +9,9 @@ import Control.Monad (forM_) import Data.List (intercalate) import Data.Version (Version(..))-import Prelude hiding (readFile) import System.Console.CmdArgs-import System.IO (hPutStrLn, stderr)-import System.IO.Strict (readFile)+import System.IO (hPutStrLn, stderr, withFile, hSetEncoding, IOMode(ReadMode), utf8)+import System.IO.Strict (hGetContents) --------------------------------------------------------------------------------@@ -53,7 +52,7 @@ | defaults sa = do fileName <- defaultConfigFilePath verbose' $ "Dumping config from " ++ fileName- readFile fileName >>= putStr+ readUTF8File fileName >>= putStr | otherwise = do conf <- loadConfig verbose' (config sa) let steps = configSteps conf@@ -70,12 +69,22 @@ -- | Processes a single file, or stdin if no filepath is given file :: StylishArgs -> Config -> Maybe FilePath -> IO () file sa conf mfp = do- contents <- maybe getContents readFile mfp+ contents <- maybe getContents readUTF8File mfp let result = runSteps (configLanguageExtensions conf) mfp (configSteps conf) $ lines contents- case result of- Left err -> hPutStrLn stderr err >> write contents- Right ok -> write $ unlines ok+ Left err -> hPutStrLn stderr err >> write contents contents+ Right ok -> write contents $ unlines ok where- write = maybe putStr (if inPlace sa then writeFile else const putStr) mfp+ write old new = case mfp of+ Nothing -> putStr new+ Just _ | not (inPlace sa) -> putStr new+ Just path | length new /= 0 && old /= new -> writeFile path new+ _ -> return ()++readUTF8File :: FilePath -> IO String+readUTF8File fp =+ withFile fp ReadMode $ \h -> do+ hSetEncoding h utf8+ content <- hGetContents h+ return content
stylish-haskell.cabal view
@@ -1,5 +1,5 @@ Name: stylish-haskell-Version: 0.5.10.0+Version: 0.5.10.1 Synopsis: Haskell code prettifier Homepage: https://github.com/jaspervdj/stylish-haskell License: BSD3@@ -46,7 +46,7 @@ Paths_stylish_haskell Build-depends:- aeson >= 0.6 && < 0.8,+ aeson >= 0.6 && < 0.9, base >= 4 && < 5, bytestring >= 0.9 && < 0.11, containers >= 0.3 && < 0.6,@@ -67,7 +67,7 @@ strict >= 0.3 && < 0.4, cmdargs >= 0.9 && < 0.11, -- Copied from regular dependencies...- aeson >= 0.6 && < 0.8,+ aeson >= 0.6 && < 0.9, base >= 4 && < 5, bytestring >= 0.9 && < 0.11, containers >= 0.3 && < 0.6,@@ -99,7 +99,7 @@ test-framework >= 0.4 && < 0.9, test-framework-hunit >= 0.2 && < 0.4, -- Copied from regular dependencies...- aeson >= 0.6 && < 0.8,+ aeson >= 0.6 && < 0.9, base >= 4 && < 5, bytestring >= 0.9 && < 0.11, cmdargs >= 0.9 && < 0.11,