on master help sign in
Drop RFC 4627 conformance
c93e8a1Bryan O'Sullivan
Data/Aeson/Parser/Internal.hs+12−14
@@ -72,32 +72,30 @@ import qualified Data.HashMap.Strict as H
72#define C_n 110
72#define C_n 110
73#define C_t 116
73#define C_t 116
74
74
75−-- | Parse a top-level JSON value. This must be either an object or
75+-- | Parse a top-level JSON value.
76−-- an array, per RFC 4627.
77--
76--
78-- The conversion of a parsed value to a Haskell value is deferred
77-- The conversion of a parsed value to a Haskell value is deferred
79-- until the Haskell value is needed. This may improve performance if
78-- until the Haskell value is needed. This may improve performance if
80-- only a subset of the results of conversions are needed, but at a
79-- only a subset of the results of conversions are needed, but at a
81-- cost in thunk allocation.
80-- cost in thunk allocation.
81+--
82+-- This function is an alias for 'value'. In aeson 0.8 and earlier, it
83+-- parsed only object or array types, in conformance with the
84+-- now-obsolete RFC 4627.
82json :: Parser Value
85json :: Parser Value
83−json = json_ object_ array_
86+json = value
84
87
85−-- | Parse a top-level JSON value. This must be either an object or
88+-- | Parse a top-level JSON value.
86−-- an array, per RFC 4627.
87--
89--
88-- This is a strict version of 'json' which avoids building up thunks
90-- This is a strict version of 'json' which avoids building up thunks
89-- during parsing; it performs all conversions immediately. Prefer
91-- during parsing; it performs all conversions immediately. Prefer
90-- this version if most of the JSON data needs to be accessed.
92-- this version if most of the JSON data needs to be accessed.
93+--
94+-- This function is an alias for 'value''. In aeson 0.8 and earlier, it
95+-- parsed only object or array types, in conformance with the
96+-- now-obsolete RFC 4627.
91json' :: Parser Value
97json' :: Parser Value
92−json' = json_ object_' array_'
98+json' = value'
93−
94−json_ :: Parser Value -> Parser Value -> Parser Value
95−json_ obj ary = do
96− w <- skipSpace *> A.satisfy (\w -> w == OPEN_CURLY || w == OPEN_SQUARE)
97− if w == OPEN_CURLY
98− then obj
99− else ary
100−{-# INLINE json_ #-}
101
99
102object_ :: Parser Value
100object_ :: Parser Value
103object_ = {-# SCC "object_" #-} Object <$> objectValues jstring value
101object_ = {-# SCC "object_" #-} Object <$> objectValues jstring value