nh2/aesonbson — pull request #2 by jbracker (2013-11-21 10:29:51+00:00)
Title: Fixed incorrect translation of ObjectIds to Strings

`show (read "000000010000000000000001" :: ObjectId)` leads to `"000000010000000000000001"`. This is important, because AesonBson converts a BSON `ObjectId` into a JSON String. So to decode a `ObjectId` from JSON we need to call `read`. But with the old implementation of `aesonifyValue` the above `ObjectId` was converted to the JSON string `"11"`, because `showHex` removes leading zeros. Using `show` instead correctly encodes a `ObjectId` so it can be `read` from a JSON string afterwards.

Of course, in most cases the numbers will have enough digits to avoid this problem, but there is nothing in the [BSON documentation] preventing them from being small.

[BSON documentation]: http://hackage.haskell.org/package/bson-0.2.3/docs/Data-Bson.html#t:ObjectId