
3 Mar
2021
3 Mar
'21
3:27 p.m.
Dear Cafe, why is Aeson's instance FromJSON IntMap so different from the instance of Map? Apparently the Map instance expects an Object (the dictionary) while the IntMap instance [1] is implemented using IntMap.fromList, so it expects an array. I can of course decode the JSON as (Map Int) and then use IntMap.fromAscList . Map.assocs but how efficient is that? And it also relies on Map.assocs producing the list in the order expected by fromAscList which (unlikely) could be broken in a future version of containers. Thanks Olaf [1] https://hackage.haskell.org/package/aeson-1.5.6.0/docs/src/Data.Aeson.Types....