16th
Using and Parsing Dates in Haskell
Recently I’ve been playing around with the Github API, and I wanted to do some code using Haskell. I’ve been using several libraries like aeson, enumerator, http-enumerator, among others.
One of the details I was really concerned about was the time structures in Haskell, I didn’t know exactly which module to use, and there were at least two options:
After investigating a little bit about each, I settled down with Data.Time.Clock. The main reason to use it, was because this is the lib that Bryan O’Sullivan uses in his aeson library, and by seeing how he used it, I discovered how to parse dates from Strings easily in Haskell; using the Data.Time.Format, one has utility methods to parse strings into UTCTime. I did some handy code to parse the dates out of the Github api like so: I really recommend reading the aeson library, is one of a kind.
