The aeson package uses Scientific which avoids numeric instability from floating point numbers. This package uses Double, and that causes its behavior to diverge from that of aeson when dealing with decimal numbers. Here's an example ghci session that illustrates the issue:
λ fromRight "error" (Data.Aeson.eitherDecode "{\"foo\": 0.1}") :: Data.Aeson.Value
Object (fromList [("foo",Number 0.1)])
λ fromRight "error" (Data.YAML.Aeson.decode1Strict "foo: 0.1") :: Data.Aeson.Value
Object (fromList [("foo",Number 0.1000000000000000055511151231257827021181583404541015625)])
Would you be willing to accept a pull request that solves this problem? If so, any pointers as to what solution you'd prefer?
The
aesonpackage uses Scientific which avoids numeric instability from floating point numbers. This package uses Double, and that causes its behavior to diverge from that ofaesonwhen dealing with decimal numbers. Here's an example ghci session that illustrates the issue:Would you be willing to accept a pull request that solves this problem? If so, any pointers as to what solution you'd prefer?