@@ -1,7 +1,7 @@
11{-# LANGUAGE OverloadedStrings #-}
22{-# LANGUAGE QuasiQuotes #-}
33
4−module Stack.Config.YamlSpec where
4+module Stack.Config.YamlSpec (spec) where
55
66import Data.ByteString
77import Data.Text.Encoding as T
@@ -150,8 +150,11 @@ configNew = Config
150150spec :: Spec
151151spec = describe "Config" $ do
152152 specify "minimal" $
153− (Y.decode configYamlMinimal :: Maybe Config) `shouldBe` Just configMinimal
153+ (decodeMaybe configYamlMinimal :: Maybe Config) `shouldBe` Just configMinimal
154154 specify "full" $
155− (Y.decode configYaml :: Maybe Config) `shouldBe` Just config
155+ (decodeMaybe configYaml :: Maybe Config) `shouldBe` Just config
156156 specify "new" $
157− (Y.decode configNewYaml :: Maybe Config) `shouldBe` Just configNew
157+ (decodeMaybe configNewYaml :: Maybe Config) `shouldBe` Just configNew
158+
159+decodeMaybe :: ByteString -> Maybe Config
160+decodeMaybe = either (const Nothing) id . Y.decodeEither'