Created
December 23, 2013 14:24
-
-
Save funrep/8097890 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.IntMap (IntMap) | |
import qualified Data.IntMap as IM | |
import qualified Data.HashMap.Strict as HM | |
import Data.Aeson | |
transformIM :: ToJSON a => IntMap a -> Object | |
transformIM = HM.map toJSON . HM.fromList . convertKeys . IM.toList | |
where convertKeys = map (\(k, v) -> (T.pack $ show k, v)) |
Author
funrep
commented
Dec 23, 2013
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment