packages feed

aeson 0.3.0.0 → 0.3.1.0

raw patch · 3 files changed

+19/−3 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

Data/Aeson/Generic.hs view
@@ -26,6 +26,7 @@ import Data.Aeson.Types hiding (FromJSON(..), ToJSON(..), fromJSON) import Data.Attoparsec.Number (Number) import Data.Generics+import Data.Hashable (Hashable) import Data.Int (Int8, Int16, Int32, Int64) import Data.IntSet (IntSet) import Data.Maybe (fromJust)@@ -159,7 +160,7 @@              `ext1R` list              `ext1R` vector              `ext2R'` mapAny-             -- Don't know how to support parsing HashMaps :-(+             `ext2R'` hashMapAny              -- Use the standard encoding for all base types.              `extR` (value :: F Integer)              `extR` (value :: F Int)@@ -214,6 +215,20 @@                                       "mapAny -- should never happen"             tyrep = typeOf (undefined :: f)             remap f = fromJust . cast . f+    hashMapAny :: forall e f. (Data e, Data f) => Parser (H.HashMap f e)+    hashMapAny+        | tyrep == typeOf ""       = process DT.unpack+        | tyrep == typeOf LT.empty = process LT.fromStrict+        | tyrep == typeOf DT.empty = process id+        | otherwise = myFail+      where+        process f = maybe myFail return . cast =<< parseWith f+        parseWith :: (Eq c, Hashable c) => (Text -> c) -> Parser (H.HashMap c e)+        parseWith f = case j of+                        Object js -> H.fromList . map (first f) . Map.toList <$>+                                     T.mapM parseJSON js+                        _          -> myFail+        tyrep = typeOf (undefined :: f)     myFail = modFail "parseJSON" $ "bad data: " ++ show j     stringyTypes = [typeOf LT.empty, typeOf DT.empty, typeOf B.empty,                      typeOf L.empty, typeOf ""]
Data/Aeson/Types.hs view
@@ -603,7 +603,8 @@     {-# INLINE parseJSON #-}  instance ToJSON UTCTime where-    toJSON t = String (pack (formatTime defaultTimeLocale "%FT%X%QZ" t))+    toJSON t = String (pack (take 23 str ++ "Z"))+      where str = formatTime defaultTimeLocale "%FT%T%Q" t     {-# INLINE toJSON #-}  instance FromJSON UTCTime where
aeson.cabal view
@@ -1,5 +1,5 @@ name:            aeson-version:         0.3.0.0+version:         0.3.1.0 license:         BSD3 license-file:    LICENSE category:        Text, Web, JSON