Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aeson-0.10.0.0 - encoding of UTCTime values #313

Closed
epsilonhalbe opened this issue Nov 3, 2015 · 7 comments
Closed

aeson-0.10.0.0 - encoding of UTCTime values #313

epsilonhalbe opened this issue Nov 3, 2015 · 7 comments

Comments

@epsilonhalbe
Copy link

I experience a problem in the Hackage edition of aeson 0.10.0.0

If I take the following expression

Prelude > import Data.Aeson
Prelude Data.Aeson > import Data.Time
Prelude Data.Aeson Data.Time > x <- getCurrentTime
Prelude Data.Aeson Data.Time > decode (encode [x]) :: Maybe [UTCTime]
Nothing

while the current Master succeeds.

Funny enough if you fix the test suite (see #312) by copying the missing files the test suite reports an OK.

a minimal test property (in the style of tasty) could be

prop_encode_decode = testProperty "encoding -> decoding for UTCTime" $ \x -> Just ([x :: UTCTime]) == decode (encode [x])
@dzhus
Copy link

dzhus commented Nov 9, 2015

Can confirm, UTCTime is not properly quoted:

Data.Aeson Data.Time> encode now
"2015-11-09T19:15:53.295211Z"

(It should be "\"2015-11-09T19:15:53.295211Z\"" instead)

@dzhus
Copy link

dzhus commented Nov 9, 2015

I believe it was fixed in 0b98185. Can we see a release please?

@epsilonhalbe
Copy link
Author

I checked with manual escaping everything works fine

Prelude > :set -XOverloadedStrings
Prelude > import Data.Aeson as A
Prelude Data.Aeson > import Data.Time
Prelude Data.Aeson Data.Time > import Data.Monoid
Prelude Data.Aeson Data.Time Data.Monoid > x <- getCurrentTime
Prelude Data.Aeson Data.Time Data.Monoid > decode ("[\""<>encode x<>"\"]") :: Maybe [UTCTime]
Just [2015-11-10 08:52:21.21633 UTC]

@epsilonhalbe epsilonhalbe changed the title aeson-0.10.0.0 aeson-0.10.0.0 - encoding of UTCTime values Nov 10, 2015
@jkr
Copy link

jkr commented Nov 14, 2015

Might not be the best venue for this, but is there any easy way to work around this issue until a new release comes out? I'm currently just wrapping data UTCTime' = UTCTime' UTCTime and defining an instance on that with the default and constructTagModifier wrapping it in quotes. This just seemed like the easiest to remove when a new release comes out. But is there some more straightforward approach I'm missing?

@jkr
Copy link

jkr commented Nov 14, 2015

... or, I suppose, just hold the version at <0.10 in the cabal file. That seems to work. Sorry for the noise.

@epsilonhalbe
Copy link
Author

@jkr - or you can just use this version on github - that seems to work allright

dzhus referenced this issue in bitemyapp/bloodhound Dec 22, 2015
@bos
Copy link
Collaborator

bos commented Jan 22, 2016

I'm going to close this as it's fixed. Sorry for the inconvenience. 0.11 will be out hopefully by the end of the month.

@bos bos closed this as completed Jan 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants