lpsmith/postgresql-simple — pull request #83 by basvandijk (2013-09-15 09:28:10+00:00)
Title: Parse a strict ByteString to a JSON.Value directly using eitherDecodeStrict'

I realized the latest aeson added decoders for strict ByteStrings. So there's no need to first convert to a lazy ByteString.

The only thing I'm not sure about is which of these to use:

* `eitherDecodeStrict`:
The conversion of a parsed value to a Haskell value is deferred until the Haskell value is needed. This may improve performance if only a subset of the results of conversions are needed, but at a cost in thunk allocation.

* `eitherDecodeStrict'`:
This is a strict version which avoids building up thunks during parsing; it performs all conversions immediately. Prefer this version if most of the JSON data needs to be accessed.

I've now chosen `eitherDecodeStrict'` since that gives more predicatable memmory usage. Also if the user doesn't need to parse the whole `JSON.Value` he could choose not to return the whole JSON string from the query (using the postgresql-9.3 [JSON functions](http://www.postgresql.org/docs/9.3/static/functions-json.html)).