
Hi, The json/haskell-json package has a cabal flag named "mapdict" which is disabled by default. I find this completely counter-intuitive as the default behavior will convert Data.Map values to JSON *list* values. With the flag enabled, Data.Map values will be converted to JSON map values as expected. Just to give a concrete example: Default behavior:
import Data.Map import Text.JSON putStrLn $ encode $ insert "foo" "bar" empty ["foo","bar]
With mapdict enabled:
import Data.Map import Text.JSON putStrLn $ encode $ insert "foo" "bar" empty {"foo":"bar"}
The only possible reason that I can think of for this default behavior would be some sort of performance metric, but I doubt that it would be significant, especially not for such improper behavior. Would it be possible (i.e. technically trivial and not against policy) to add "--flags mapdict" to the configure command in the haskell-json PKGBUILD? I'll send an email to the json maintainer as well to see if I can get the default changed. Thanks! Regards, Xyne

Quoting Xyne (2013-06-03 02:27:40)
Hi,
The json/haskell-json package has a cabal flag named "mapdict" which is disabled by default. I find this completely counter-intuitive as the default behavior will convert Data.Map values to JSON *list* values. With the flag enabled, Data.Map values will be converted to JSON map values as expected.
FYI, I found the Aeson package to be of better quality than all the other JSON packages I have tried. I switched to it in my JSON tool collection recently [1]. All the best, -- NP [1]: https://github.com/np/json-tools
participants (2)
-
Nicolas Pouillard
-
Xyne