Use `prettyPrintParseException` in `decodeEither`.
The rationale is that if you're getting back a raw `String`, you care
more about its readability rather than how faithfully it represent the
data structure. If you want information about the data structure,
you're better off with `decodeEither'`.
commit730dda7cfb1040c4e641bf88bf4447e9b7e6de65
authorFrancesco Mazzoli <f@mazzo.li>
dateThu 27 Aug 2015, 17:51 (11 years ago)
parent18ce568
Data/Yaml.hs+1−1
@@ -167,7 +167,7 @@ decodeFileEither = decodeHelper_ . Y.decodeFile
167167
168168decodeEither :: FromJSON a => ByteString -> Either String a
169169decodeEither bs = unsafePerformIO
170− $ fmap (either (Left . show) id)
170+ $ fmap (either (Left . prettyPrintParseException) id)
171171 $ decodeHelper (Y.decode bs)
172172
173173-- | More helpful version of 'decodeEither' which returns the 'YamlException'.