on master help sign in
Fixed #62.

Nullary constructors are encoded as an empty array. The syb code wrongfully assumed they were encoded as Null.

commit613cf6173ddada923d704854891262aff02b543f authorBas van Dijk <v.dijk.bas@gmail.com> dateSat 14 Jan 2012, 18:09 (15 years ago) parentf134d44
1 file changed+1−3
Data/Aeson/Generic.hs+1−3
Data/Aeson/Generic.hs+1−3
@@ -290,10 +290,8 @@ parseJSON_generic j = generic
290290 decodeArgs c0 = go (numConstrArgs (resType generic) c0) c0
291291 (constrFields c0)
292292 where
293− go 0 c _ Null = construct c [] -- nullary constructor
294293 go 1 c [] jd = construct c [jd] -- unary constructor
295− go n c [] (Array js)
296− | n > 1 = construct c (V.toList js) -- no field names
294+ go _ c [] (Array js) = construct c (V.toList js) -- no field names
297295 -- FIXME? We could allow reading an array into a constructor
298296 -- with field names.
299297 go _ c fs@(_:_) (Object o) = selectFields o fs >>=