git.iko.soy/typeable/postgresql-simple
on master help sign in
Fix Json decoding

Closes #90. Thanks to Amit Levy for the report. See also #79, #80, #81, and #83. Looks like CPP was needed after all.

commit46605ebe3050b535a2480ee252c3cc57a0d11234 authorLeon P Smith <leon@melding-monads.com> dateSat 21 Dec 2013, 06:46 (13 years ago) parent0e2492e
1 file changed+6
src/Database/PostgreSQL/Simple/FromField.hs+6
src/Database/PostgreSQL/Simple/FromField.hs+6
@@ -460,7 +460,13 @@ instance FromField JSON.Value where
460460 else case mbs of
461461 Nothing -> returnError UnexpectedNull f ""
462462 Just bs ->
463+#if MIN_VERSION_aeson(0,6,3)
463464 case JSON.eitherDecodeStrict' bs of
465+#elsif MIN_VERSION_bytestring(0,10,0)
466+ case JSON.eitherDecode' $ LB.fromStrict bs of
467+#else
468+ case JSON.eitherDecode' $ LB.fromChunks [bs] of
469+#endif
464470 Left err -> returnError ConversionFailed f err
465471 Right val -> pure val
466472