aeson 0.7.0.2 → 0.7.0.3
raw patch · 4 files changed
+17/−4 lines, 4 files
Files
- Data/Aeson.hs +1/−0
- Data/Aeson/TH.hs +11/−2
- Data/Aeson/Types/Instances.hs +4/−1
- aeson.cabal +1/−1
Data/Aeson.hs view
@@ -68,6 +68,7 @@ , withText , withArray , withNumber+ , withScientific , withBool -- * Constructors and accessors , (.=)
Data/Aeson/TH.hs view
@@ -165,7 +165,7 @@ where fromCons :: [TyVarBndr] -> [Con] -> Q Dec fromCons tvbs cons =- instanceD (return $ map (\t -> ClassP ''ToJSON [VarT t]) typeNames)+ instanceD (applyCon ''ToJSON typeNames) (classType `appT` instanceType) [ funD 'toJSON [ clause []@@ -372,7 +372,7 @@ where fromCons :: [TyVarBndr] -> [Con] -> Q Dec fromCons tvbs cons =- instanceD (return $ map (\t -> ClassP ''FromJSON [VarT t]) typeNames)+ instanceD (applyCon ''FromJSON typeNames) (classType `appT` instanceType) [ funD 'parseJSON [ clause []@@ -872,3 +872,12 @@ valueConName (Number _) = "Number" valueConName (Bool _) = "Boolean" valueConName Null = "Null"++applyCon :: Name -> [Name] -> Q [Pred]+applyCon con typeNames = return (map apply typeNames)+ where apply t =+#if __GLASGOW_HASKELL__ >= 709+ AppT (ConT con) (VarT t)+#else+ ClassP con [VarT t]+#endif
Data/Aeson/Types/Instances.hs view
@@ -107,7 +107,10 @@ parseJSON (Object (H.toList -> [(key, value)])) | key == left = Left <$> parseJSON value | key == right = Right <$> parseJSON value- parseJSON _ = fail ""+ parseJSON _ = fail $+ "expected an object with a single property " +++ "where the property key should be either " +++ "\"Left\" or \"Right\"" {-# INLINE parseJSON #-} left, right :: Text
aeson.cabal view
@@ -1,5 +1,5 @@ name: aeson-version: 0.7.0.2+version: 0.7.0.3 license: BSD3 license-file: LICENSE category: Text, Web, JSON