aeson 0.6.0.1 → 0.6.0.2
raw patch · 5 files changed
+24/−63 lines, 5 filesdep ~textPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: text
API changes (from Hackage documentation)
Files
- Data/Aeson/TH.hs +8/−36
- Data/Aeson/Types/Class.hs +4/−4
- Data/Aeson/Types/Generic.hs +10/−18
- aeson.cabal +2/−2
- release-notes.markdown +0/−3
Data/Aeson/TH.hs view
@@ -159,22 +159,21 @@ import Data.Aeson.Types ( Value(..), Parser ) -- from base: import Control.Applicative ( pure, (<$>), (<*>) )-import Control.Monad ( return, mapM, liftM2, fail, (>>=) )+import Control.Monad ( return, mapM, liftM2, fail ) import Data.Bool ( otherwise ) import Data.Eq ( (==) )-import Data.Function ( ($), (.), id, fix )+import Data.Function ( ($), (.), id ) import Data.Functor ( fmap ) import Data.List ( (++), foldl, foldl', intercalate , length, map, zip, genericLength )-import qualified Data.Set as Set import Data.Maybe ( Maybe(Nothing, Just) )-import Prelude ( String, (-), Integer, fromIntegral, error, snd )+import Prelude ( String, (-), Integer, fromIntegral, error ) import Text.Printf ( printf ) import Text.Show ( show ) #if __GLASGOW_HASKELL__ < 700 import Control.Monad ( (>>=) )-import Prelude ( fromInteger, snd )+import Prelude ( fromInteger ) #endif -- from unordered-containers: import qualified Data.HashMap.Strict as H ( lookup, toList, size )@@ -263,32 +262,9 @@ ] where classType = conT ''ToJSON- lhsTypNames = map tvbName tvbs- rhsTypNames = getTypVarNames cons- typeNames = Set.toList $ Set.intersection- (Set.fromList lhsTypNames)- (Set.fromList rhsTypNames)- instanceType = foldl' appT (conT name) $ map varT lhsTypNames+ typeNames = map tvbName tvbs+ instanceType = foldl' appT (conT name) $ map varT typeNames --- gets all type variable names from the constructors-getTypVarNames :: [Con] -> [Name]-getTypVarNames cons- = types >>= fix (\f t -> case t of- ForallT _ _ ty -> f ty- VarT v -> [v]- AppT ty1 ty2 -> f ty1 ++ f ty2- SigT ty _ -> f ty- _ -> []- )- where- types = cons >>= conTyps- conTyps :: Con -> [Type]- conTyps (NormalC _ stys) = map snd stys- conTyps (RecC _ vstys) = map (\(_, _, ty) -> ty) vstys- conTyps (InfixC (_, ty1) _ (_, ty2)) = [ty1, ty2]- conTyps (ForallC _ _ c) = conTyps c -- quantified typ vars will be taken care of by intersection with lhs type vars- - -- | Generates a lambda expression which encodes the given data type as JSON. -- -- Example:@@ -459,12 +435,8 @@ ] where classType = conT ''FromJSON- lhsTypNames = map tvbName tvbs- rhsTypNames = getTypVarNames cons- typeNames = Set.toList $ Set.intersection- (Set.fromList lhsTypNames)- (Set.fromList rhsTypNames)- instanceType = foldl' appT (conT name) $ map varT lhsTypNames+ typeNames = map tvbName tvbs+ instanceType = foldl' appT (conT name) $ map varT typeNames -- | Generates a lambda expression which parses the JSON encoding of the given -- data type.
Data/Aeson/Types/Class.hs view
@@ -103,11 +103,11 @@ -- Instead of manually writing your 'ToJSON' instance, there are three options -- to do it automatically: ----- * 'Data.Aeson.TH' provides template-haskell functions which will derive an+-- * "Data.Aeson.TH" provides template-haskell functions which will derive an -- instance at compile-time. The generated instance is optimized for your type -- so will probably be more efficient than the following two options: ----- * 'Data.Aeson.Generic' provides a generic @toJSON@ function that accepts any+-- * "Data.Aeson.Generic" provides a generic @toJSON@ function that accepts any -- type which is an instance of 'Data'. -- -- * If your compiler has support for the @DeriveGeneric@ and@@ -164,11 +164,11 @@ -- Instead of manually writing your 'FromJSON' instance, there are three options -- to do it automatically: ----- * 'Data.Aeson.TH' provides template-haskell functions which will derive an+-- * "Data.Aeson.TH" provides template-haskell functions which will derive an -- instance at compile-time. The generated instance is optimized for your type -- so will probably be more efficient than the following two options: ----- * 'Data.Aeson.Generic' provides a generic @fromJSON@ function that parses to+-- * "Data.Aeson.Generic" provides a generic @fromJSON@ function that parses to -- any type which is an instance of 'Data'. -- -- * If your compiler has support for the @DeriveGeneric@ and
Data/Aeson/Types/Generic.hs view
@@ -1,20 +1,13 @@-{-# LANGUAGE DefaultSignatures- , EmptyDataDecls- , FlexibleInstances- , FunctionalDependencies- , KindSignatures- , OverlappingInstances- , ScopedTypeVariables- , TypeOperators- , UndecidableInstances- , ViewPatterns- #-}-+{-# LANGUAGE DefaultSignatures, EmptyDataDecls, FlexibleInstances,+ FunctionalDependencies, KindSignatures, OverlappingInstances,+ ScopedTypeVariables, TypeOperators, UndecidableInstances, ViewPatterns #-} {-# OPTIONS_GHC -fno-warn-orphans #-} -- | -- Module: Data.Aeson.Types.Generic--- Copyright: (c) 2011 MailRank, Inc.+-- Copyright: (c) 2012 Bryan O'Sullivan+-- (c) 2011 Bas Van Dijk+-- (c) 2011 MailRank, Inc. -- License: Apache -- Maintainer: Bryan O'Sullivan <bos@serpentine.com> -- Stability: experimental@@ -24,16 +17,15 @@ module Data.Aeson.Types.Generic ( ) where -import Control.Applicative-import Control.Monad.State.Strict-import Data.Bits (shiftR)+import Control.Applicative ((<*>), (<$>), (<|>), pure)+import Control.Monad.ST (ST) import Data.Aeson.Types.Class import Data.Aeson.Types.Internal-import Data.Text (pack, unpack)+import Data.Bits (shiftR) import Data.DList (DList, toList) import Data.Monoid (mappend)+import Data.Text (pack, unpack) import GHC.Generics-import Control.Monad.ST (ST) import qualified Data.HashMap.Strict as H import qualified Data.Text as T import qualified Data.Vector as V
aeson.cabal view
@@ -1,5 +1,5 @@ name: aeson-version: 0.6.0.1+version: 0.6.0.2 license: BSD3 license-file: LICENSE category: Text, Web, JSON@@ -130,7 +130,7 @@ old-locale, syb, template-haskell >= 2.4,- text >= 0.11.0.2,+ text >= 0.11.1.0, time, unordered-containers >= 0.1.3.0, vector >= 0.7.1
release-notes.markdown view
@@ -1,6 +1,3 @@-# 0.6.0.1-No more constraints on phantom types- # 0.5 to 0.6 This release introduces a slightly obscure, but