rest-stringmap 0.1.0.1 → 0.2
raw patch · 7 files changed
+16/−20 lines, 7 files
Files
- CHANGELOG.md +7/−2
- rest-stringmap.cabal +1/−1
- src/Rest/StringMap/HashMap/Lazy.hs +3/−3
- src/Rest/StringMap/HashMap/Strict.hs +3/−3
- src/Rest/StringMap/Map/Lazy.hs +1/−1
- src/Rest/StringMap/Map/Strict.hs +1/−1
- src/Rest/StringMap/Util.hs +0/−9
CHANGELOG.md view
@@ -1,9 +1,14 @@ # Changelog -# 0.1.0.1+## 0.2 +* Fix loop in ToJSON instances for StringHashMaps+* `mapToJSON` and `mapParseJSON` have been removed from `Rest.StringMap.Util`.++#### 0.1.0.1+ * Add missing `tagged` dependency -# 0.1.0.0+#### 0.1.0.0 * Initial release
rest-stringmap.cabal view
@@ -1,5 +1,5 @@ name: rest-stringmap-version: 0.1.0.1+version: 0.2 license: BSD3 synopsis: Maps with stringy keys that can be transcoded to JSON and XML. description: Maps with stringy keys that can be transcoded to JSON and XML.
src/Rest/StringMap/HashMap/Lazy.hs view
@@ -52,10 +52,10 @@ xpickle = pickleMap mapKeys mapKeys instance (ToString a, ToJSON b) => ToJSON (StringHashMap a b) where- toJSON = mapToJSON mapKeys+ toJSON = toJSON . toHashMap . mapKeys toString -instance (Hashable a, Eq a, IsString a, FromJSON b) => FromJSON (StringHashMap a b) where- parseJSON = mapParseJSON mapKeys+instance (Eq a, Hashable a, IsString a, FromJSON b) => FromJSON (StringHashMap a b) where+ parseJSON = fmap (mapKeys fromString . fromHashMap) . parseJSON instance JSONSchema b => JSONSchema (StringHashMap a b) where schema _ = mapSchema (Proxy :: Proxy b)
src/Rest/StringMap/HashMap/Strict.hs view
@@ -52,10 +52,10 @@ xpickle = pickleMap mapKeys mapKeys instance (ToString a, ToJSON b) => ToJSON (StringHashMap a b) where- toJSON = mapToJSON mapKeys+ toJSON = toJSON . toHashMap . mapKeys toString -instance (Hashable a, Eq a, IsString a, FromJSON b) => FromJSON (StringHashMap a b) where- parseJSON = mapParseJSON mapKeys+instance (Eq a, Hashable a, IsString a, FromJSON b) => FromJSON (StringHashMap a b) where+ parseJSON = fmap (mapKeys fromString . fromHashMap) . parseJSON instance JSONSchema b => JSONSchema (StringHashMap a b) where schema _ = mapSchema (Proxy :: Proxy b)
src/Rest/StringMap/Map/Lazy.hs view
@@ -48,7 +48,7 @@ xpickle = pickleMap mapKeys mapKeys instance (ToString a, ToJSON b) => ToJSON (StringMap a b) where- toJSON = toJSON . M.mapKeys toString . unM+ toJSON = toJSON . M.mapKeys toString . toMap instance (Ord a, IsString a, FromJSON b) => FromJSON (StringMap a b) where parseJSON = fmap (StringMap . M.mapKeys fromString) . parseJSON
src/Rest/StringMap/Map/Strict.hs view
@@ -48,7 +48,7 @@ xpickle = pickleMap mapKeys mapKeys instance (ToString a, ToJSON b) => ToJSON (StringMap a b) where- toJSON = toJSON . M.mapKeys toString . unM+ toJSON = toJSON . M.mapKeys toString . toMap instance (Ord a, IsString a, FromJSON b) => FromJSON (StringMap a b) where parseJSON = fmap (StringMap . M.mapKeys fromString) . parseJSON
src/Rest/StringMap/Util.hs view
@@ -2,11 +2,8 @@ ( pickleStringMap , pickleMap , mapSchema- , mapToJSON- , mapParseJSON ) where -import Data.Aeson.Types import Data.JSON.Schema (JSONSchema, Schema, schema) import Data.JSON.Schema.Combinators (field) import Data.Proxy (Proxy)@@ -25,9 +22,3 @@ mapSchema :: JSONSchema a => Proxy a -> Schema mapSchema = field "key" False . schema--mapToJSON :: (ToString a, ToJSON m) => ((a -> String) -> m' -> m) -> m' -> Value-mapToJSON mapKeys = toJSON . mapKeys toString--mapParseJSON :: (FromJSON m, IsString k) => ((String -> k) -> m -> m') -> Value -> Parser m'-mapParseJSON mapKeys = fmap (mapKeys fromString) . parseJSON