packages feed

aeson-flat 0.1.0.0 → 0.1.1

raw patch · 2 files changed

+7/−7 lines, 2 filesdep ~aeson

Dependency ranges changed: aeson

Files

aeson-flat.cabal view
@@ -1,5 +1,5 @@ name:                aeson-flat-version:             0.1.0.0+version:             0.1.1 synopsis:            Tools for creating flat JSON serializations description:         Tools for creating flat JSON serializations homepage:            https://github.com/seanhess/aeson-flat#readme@@ -18,7 +18,7 @@   exposed-modules:     Data.Aeson.Flat   build-depends:       base >= 4.7 && < 5-    , aeson >= 0.8+    , aeson >= 1.0     , text     , vector     , unordered-containers
src/Data/Aeson/Flat.hs view
@@ -8,7 +8,7 @@ -- import Debug.Trace (trace) import Control.Applicative ((<|>)) import Data.Aeson (Value(..))-import Data.Aeson.Types (genericToJSON, genericParseJSON, defaultOptions, GToJSON, GFromJSON, Parser, typeMismatch)+import Data.Aeson.Types (genericToJSON, genericParseJSON, defaultOptions, GToJSON, GFromJSON, Parser, typeMismatch, Zero) import Data.Text (Text, unpack) import qualified Data.Vector as V import Data.Monoid ((<>))@@ -66,7 +66,7 @@ -- {"c": "CA", "one": "value", "two": "value"} -- {"c": "CB", "three": "value"} -flatToJSON :: (Generic a, GToJSON (Rep a)) => Text -> a -> Value+flatToJSON :: (Generic a, GToJSON Zero (Rep a)) => Text -> a -> Value flatToJSON n a =   flatten n $ genericToJSON defaultOptions a   where@@ -101,7 +101,7 @@ -- > instance FromJSON C where -- >   parseJSON x = flatParseJSON "c" x -flatParseJSON :: (Generic a, GFromJSON (Rep a)) => Text -> Value -> Parser a+flatParseJSON :: (Generic a, GFromJSON Zero (Rep a)) => Text -> Value -> Parser a flatParseJSON n (Object o) =   case HM.lookup n o of     Just (String t) ->@@ -115,7 +115,7 @@   -fieldToJSON :: (Generic a, GToJSON (Rep a)) => Text -> a -> Value+fieldToJSON :: (Generic a, GToJSON Zero (Rep a)) => Text -> a -> Value fieldToJSON n a =   flatten n $ genericToJSON defaultOptions a   where@@ -123,7 +123,7 @@     Object $ HM.fromList [(n', v)]  -fieldParseJSON :: (Generic a, GFromJSON (Rep a)) => Text -> Value -> Parser a+fieldParseJSON :: (Generic a, GFromJSON Zero (Rep a)) => Text -> Value -> Parser a fieldParseJSON n (Object o) =   -- construct what it is expecting: tag, and contents   case HM.lookup n o of