stylish-haskell 0.5.15.2 → 0.5.16.0
raw patch · 3 files changed
+23/−24 lines, 3 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Language.Haskell.Stylish: configFilePath :: Verbose -> Maybe FilePath -> IO (Maybe FilePath)
+ Language.Haskell.Stylish: configFilePath :: Verbose -> Maybe FilePath -> IO FilePath
Files
- CHANGELOG +3/−0
- lib/Language/Haskell/Stylish/Config.hs +19/−23
- stylish-haskell.cabal +1/−1
CHANGELOG view
@@ -1,3 +1,6 @@+- 0.5.16.0+ * Fail if the default configuration file is not found.+ - 0.5.15.2 * Bump `aeson` to 0.11
lib/Language/Haskell/Stylish/Config.hs view
@@ -56,11 +56,6 @@ ---------------------------------------------------------------------------------emptyConfig :: Config-emptyConfig = Config [] 80 []----------------------------------------------------------------------------------- configFileName :: String configFileName = ".stylish-haskell.yaml" @@ -71,15 +66,21 @@ ---------------------------------------------------------------------------------configFilePath :: Verbose -> Maybe FilePath -> IO (Maybe FilePath)-configFilePath _ (Just userSpecified) = return $ Just userSpecified+configFilePath :: Verbose -> Maybe FilePath -> IO FilePath+configFilePath _ (Just userSpecified) = return userSpecified configFilePath verbose Nothing = do- current <- getCurrentDirectory- home <- getHomeDirectory- def <- defaultConfigFilePath- search $+ current <- getCurrentDirectory+ home <- getHomeDirectory+ def <- defaultConfigFilePath+ mbConfig <- search $ [d </> configFileName | d <- ancestors current] ++ [home </> configFileName, def]++ case mbConfig of+ Just config -> return config+ Nothing -> fail $+ "Language.Haskell.Stylish.Config.configFilePath: " +++ "could not load default configuration at: " ++ def where -- All ancestors of a dir (including that dir) ancestors :: FilePath -> [FilePath]@@ -97,18 +98,13 @@ -------------------------------------------------------------------------------- loadConfig :: Verbose -> Maybe FilePath -> IO Config loadConfig verbose mfp = do- mfp' <- configFilePath verbose mfp- case mfp' of- Nothing -> do- verbose $ "Using empty configuration"- return emptyConfig- Just fp -> do- verbose $ "Loading configuration at " ++ fp- bs <- B.readFile fp- case decodeEither bs of- Left err -> error $- "Language.Haskell.Stylish.Config.loadConfig: " ++ err- Right config -> return config+ fp <- configFilePath verbose mfp+ verbose $ "Loading configuration at " ++ fp+ bs <- B.readFile fp+ case decodeEither bs of+ Left err -> error $+ "Language.Haskell.Stylish.Config.loadConfig: " ++ err+ Right config -> return config --------------------------------------------------------------------------------
stylish-haskell.cabal view
@@ -1,5 +1,5 @@ Name: stylish-haskell-Version: 0.5.15.2+Version: 0.5.16.0 Synopsis: Haskell code prettifier Homepage: https://github.com/jaspervdj/stylish-haskell License: BSD3