generic-aeson 0.2.0.2 → 0.2.0.3
raw patch · 4 files changed
+12/−9 lines, 4 filesdep ~taggedPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: tagged
API changes (from Hackage documentation)
Files
- CHANGELOG.md +4/−0
- README.md +1/−1
- generic-aeson.cabal +3/−3
- src/Generics/Generic/Aeson.hs +4/−5
CHANGELOG.md view
@@ -1,5 +1,9 @@ # Changelog +#### 0.2.0.3++* Allow `tagged 0.8.*`+ #### 0.2.0.2 * Allow `generic-deriving 1.7.*`
README.md view
@@ -19,7 +19,7 @@ * Leading and trailing underscores are removed from constructor names and record fields -See `tests/Main.hs` for more examples.+See `tests/Main.hs` in [json-schema](http://hackage.haskell.org/package/json-schema) for more examples. ## How does generic-aeson compare to the TH/Generics already present in aeson?
generic-aeson.cabal view
@@ -1,5 +1,5 @@ name: generic-aeson-version: 0.2.0.2+version: 0.2.0.3 synopsis: Derivation of Aeson instances using GHC generics. description: Derivation of Aeson instances using GHC generics. author: Silk@@ -27,12 +27,12 @@ Generics.Generic.Aeson.Util Generics.Generic.IsEnum build-depends:- base >= 4 && < 4.8+ base >= 4 && < 4.9 , aeson >= 0.6 && < 0.9 , attoparsec >= 0.11 && < 0.13 , generic-deriving >= 1.6 && < 1.8 , mtl >= 2.0 && < 2.3- , tagged >= 0.2 && < 0.8+ , tagged >= 0.2 && < 0.9 , text >= 0.11 && < 1.3 , unordered-containers == 0.2.* , vector == 0.10.*
src/Generics/Generic/Aeson.hs view
@@ -40,7 +40,6 @@ ) where import Control.Applicative-import Control.Monad.Error import Control.Monad.State import Data.Aeson import Data.Aeson.Types hiding (GFromJSON, GToJSON)@@ -120,9 +119,9 @@ . return -- Structure type for constant values.-instance (ToJSON c) => GtoJson (K1 a c) where+instance ToJSON c => GtoJson (K1 a c) where gtoJSONf _ _ _ (K1 a) = Left [toJSON a]-instance (FromJSON c) => GfromJson (K1 a c) where+instance FromJSON c => GfromJson (K1 a c) where gparseJSONf _ _ _ _ = lift . fmap K1 . parseJSON =<< pop instance (GtoJson f, GtoJson g) => GtoJson (f :+: g) where@@ -209,7 +208,7 @@ gtoJSONf set mc enm (M1 (K1 (Just x))) = gtoJSONf set mc enm (M1 (K1 x) :: (M1 S c (K1 i a)) p) instance (Selector c, FromJSON a) => GfromJson (M1 S c (K1 i (Maybe a))) where gparseJSONf set mc smf enm =- do (M1 (K1 x)) <- parser+ do M1 (K1 x) <- parser return (M1 (K1 (Just x))) <|> do case selNameT set (undefined :: M1 S c (K1 i a) p) of@@ -223,7 +222,7 @@ | otherwise -> return $ M1 (K1 Nothing) _ -> lift $ typeMismatch "Object" (Array V.empty) where- parser = (gparseJSONf set mc smf enm :: StateT [Value] Parser (M1 S c (K1 i a) p))+ parser = gparseJSONf set mc smf enm :: StateT [Value] Parser (M1 S c (K1 i a) p) impossible = "The impossible happened: parser succeeded after failing in GfromJson S Maybe" selProp :: Text -> Maybe Text -> StateT [Value] Parser ()