on master help sign in
Deprecate decode and decodeEither
da49011Michael Snoyman
ChangeLog.md+1
@@ -2,6 +2,7 @@
2
2
3* Add `decodeThrow` and `decodeFileThrow` convenience functions.
3* Add `decodeThrow` and `decodeFileThrow` convenience functions.
4* Upgrade libyaml versions
4* Upgrade libyaml versions
5+* Deprecate `decode` and `decodeEither`
5
6
6## 0.8.30
7## 0.8.30
7
8
Data/Yaml.hs+2
@@ -164,6 +164,7 @@ decode :: FromJSON a
164decode bs = unsafePerformIO
164decode bs = unsafePerformIO
165 $ either (const Nothing) id
165 $ either (const Nothing) id
166 <$> decodeHelper_ (Y.decode bs)
166 <$> decodeHelper_ (Y.decode bs)
167+{-# DEPRECATED decode "Please use decodeEither or decodeThrow, which provide information on how the decode failed" #-}
167
168
168decodeFile :: FromJSON a
169decodeFile :: FromJSON a
169 => FilePath
170 => FilePath
@@ -184,6 +185,7 @@ decodeEither :: FromJSON a => ByteString -> Either String a
184decodeEither bs = unsafePerformIO
185decodeEither bs = unsafePerformIO
185 $ either (Left . prettyPrintParseException) id
186 $ either (Left . prettyPrintParseException) id
186 <$> decodeHelper (Y.decode bs)
187 <$> decodeHelper (Y.decode bs)
188+{-# DEPRECATED decodeEither "Please use decodeEither' or decodeThrow, which provide more useful failures" #-}
187
189
188-- | More helpful version of 'decodeEither' which returns the 'YamlException'.
190-- | More helpful version of 'decodeEither' which returns the 'YamlException'.
189--
191--