Fix deprecation warnings with latest versions of yaml

pull/160/head
Lennart Spitzner 2018-07-04 21:14:06 +02:00
parent 4cb3b96f07
commit 0b40dd7c32
2 changed files with 4 additions and 3 deletions

View File

@ -122,7 +122,8 @@ extractCommentConfigs anns (TopLevelDeclNameMap declNameMap) = do
, \s -> "{" `isPrefixOf` dropWhile (== ' ') s , \s -> "{" `isPrefixOf` dropWhile (== ' ') s
, Butcher.addCmdPart (Butcher.varPartDesc "yaml-config-document") , Butcher.addCmdPart (Butcher.varPartDesc "yaml-config-document")
$ fmap (\lconf -> (mempty { _conf_layout = lconf }, "")) $ fmap (\lconf -> (mempty { _conf_layout = lconf }, ""))
. Data.Yaml.decode . either (\_ -> Nothing) Just
. Data.Yaml.decodeEither'
. Data.ByteString.Char8.pack . Data.ByteString.Char8.pack
-- TODO: use some proper utf8 encoder instead? -- TODO: use some proper utf8 encoder instead?
) )

View File

@ -235,14 +235,14 @@ readConfig path = do
if exists if exists
then do then do
contents <- liftIO $ ByteString.readFile path -- no lazy IO, tyvm. contents <- liftIO $ ByteString.readFile path -- no lazy IO, tyvm.
fileConf <- case Data.Yaml.decodeEither contents of fileConf <- case Data.Yaml.decodeEither' contents of
Left e -> do Left e -> do
liftIO liftIO
$ putStrErrLn $ putStrErrLn
$ "error reading in brittany config from " $ "error reading in brittany config from "
++ path ++ path
++ ":" ++ ":"
liftIO $ putStrErrLn e liftIO $ putStrErrLn (Data.Yaml.prettyPrintParseException e)
mzero mzero
Right x -> return x Right x -> return x
return $ Just fileConf return $ Just fileConf