on master help sign in
Merge pull request #121 from cblp/incomplete-uni-patterns

Fix -Wincomplete-uni-patterns

commite834e6550fab55ac4cf84ca8d283477515eff100 authorMichael Snoyman <michael@snoyman.com> dateWed 10 Jan 2018, 19:14 (9 years ago) parent6fc6b5c40efb9e
1 file changed+3−3
exe/json2yaml.hs+3−3
exe/json2yaml.hs+3−3
@@ -1,4 +1,3 @@
1−import Control.Monad (when)
21import qualified Data.Aeson as J
32import qualified Data.ByteString as S
43import qualified Data.ByteString.Lazy as L
@@ -9,8 +8,9 @@ import qualified Data.Yaml as Y
98main :: IO ()
109main = do
1110 args <- getArgs
12− when (length args > 2) $ error "Usage: json2yaml [in] [out]"
13− let (input:output:_) = args ++ repeat "-"
11+ (input, output) <- case args ++ replicate (2 - length args) "-" of
12+ [i, o] -> return (i, o)
13+ _ -> fail "Usage: json2yaml [in] [out]"
1414 mval <- fmap J.decode $
1515 case input of
1616 "-" -> L.getContents