haskell-github-trust / thyme

A faster date and time library based on time
BSD 3-Clause "New" or "Revised" License
46 stars 33 forks source link

It would be nice if there were ToJSON/FromJSON instances #9

Closed mdorman closed 10 years ago

mdorman commented 10 years ago

I don't know that bos is likely to put them in aeson, since that would create a dependency on thyme.

I can see how the reverse might not be attractive, either---having a dependency on aeson---but since aeson seems like it's about to go into the Haskell Platform by the end of the year, maybe that wouldn't seem so onerous? Perhaps they could be introduced so that a compilation flag enables them?

I'm willing to work on writing them if you would commit to putting them in (assuming the implementation was acceptable).

liyang commented 10 years ago

If aeson makes it into the Platform then I've no objections to the dependency at all. (And even if it didn't the objection to that part is pretty minor.)

I'm just bemused by the lack of a generally agreed-upon standard for timestamps in JSON. A cursory Google found this article: so many standards to choose from… I presume you don't need compatibility with all of those.

I've recently been pondering a better interface instead of formatTime and parseTime, which are pretty slow and inflexible. The performance could also probably be improved massively. Don't hold your breath though, that might take some time.

liyang commented 10 years ago

Note: I've not tested any of this. Any strange behaviours compared to the instances for time is probably due to differences in thyme's formatting and parsing, although for something trivial like this I don't expect there to be any.