Represent JObjects with Data.Map
The [(String, JValue)]
-based representation, while simple to parse, has the disadvantage of having slow (linear-time) lookup. Using Data.Map
would have the advantage of not requiring consumers of the library to perform the conversion themselves and additionally be closer to the JSON model itself, e.g. disallowing multiple mappings for a single key and not imposing an order on the mappings.
Haskell's JSON library aeson
takes a similar approach: https://hackage.haskell.org/package/aeson-2.0.3.0/docs/Data-Aeson-KeyMap.html#t:KeyMap
Thoughts?
Edited by Fredrik Wieczerkowski