bos/aeson — Issue #72: Decoding a Map with a Maybe value fails
Author: da-x
Created: 2012-03-09 10:08:45+00:00
State: open

I'm using 0.6.0.0 with 7.4.1 on Linux x86_64.

Here's a very basic 'encode' + 'decode' chain that fails:

import Data.Aeson.Generic (decode, encode)
import qualified Data.Map as Map
import Data.Map (Map)

type SomeType = Map String (Maybe String)

main :: IO ()
main = do
let x = ((Map.fromList [("x", Nothing)]) :: SomeType)
let y = (decode (encode x) :: Maybe SomeType)
if (Just x /= y) then
error "Bug"
else
print "OK"