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

Unexpected counterexample to decode . encode = Just #24

Closed
meiersi opened this issue Mar 1, 2013 · 2 comments
Closed

Unexpected counterexample to decode . encode = Just #24

meiersi opened this issue Mar 1, 2013 · 2 comments

Comments

@meiersi
Copy link

meiersi commented Mar 1, 2013

Using yaml-0.8.2.1 imported as Y

*Schiller> Y.encode ( [""] :: [String])
"- \n"
*Schiller> Y.decode $ Y.encode ( [""] :: [String]) :: Maybe [String]
Nothing

The problem seems to be the encoding of the empty string without any quotes.

*Schiller> Y.encode ( ["a"] :: [String])
"- a\n"
*Schiller> Y.decode $ Y.encode ( ["a"] :: [String]) :: Maybe [String]
Just ["a"]
*Schiller> 

I don't know YAML well, but this is unexpected. Using aeson, imported as A, the result looks as expected.

*Schiller> A.encode ( [""] :: [String])
Chunk "[\"\"]" Empty
*Schiller> A.decode $ A.encode ( [""] :: [String]) :: Maybe [String]
Just [""]
*Schiller> 

It is thus not one of the pitfalls (http://hackage.haskell.org/packages/archive/aeson/0.6.1.0/doc/html/Data-Aeson.html#g:6) that one has to know about when using aeson.

snoyberg added a commit that referenced this issue Mar 4, 2013
@snoyberg
Copy link
Owner

snoyberg commented Mar 4, 2013

Thanks for pointing this out, it was triggered by some recent changes to do prettier printing. I just pushed a change to fix it, and released version 0.8.2.2 to Hackage. If there are still problems, please let me know.

@snoyberg snoyberg closed this as completed Mar 4, 2013
@meiersi
Copy link
Author

meiersi commented Mar 4, 2013

You're welcome. I will let you know, if I encounter further problems.

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

2 participants