Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix #72. #73

Merged
merged 1 commit into from

3 participants

@jhance

Sometimes, it appears, Nullary constructors can be encoded as Null as
well as an empty array [not sure why one this!]. The Generic code, as of
49befca, fails when a Null is
passed for a nullary constructor. Add in a pattern match to fix this
issue.

See #72

@jhance jhance Fix #72.
Sometimes, it appears, Nullary constructors can be encoded as Null as
well as an empty array [not sure why one this!]. The Generic code, as of
49befca, fails when a Null is
passed for a nullary constructor. Add in a pattern match to fix this
issue.
7639ea8
@bos
Owner

I'm nervous about accepting this patch unless @basvandijk can give it a once-over first.

@michaelklishin

#72 is currently a blocker for using Aeson (and, likely, Haskell) for me. Any ETA on when it may be finally resolved?

@bos bos merged commit 7639ea8 into bos:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 18, 2012
  1. @jhance

    Fix #72.

    jhance authored
    Sometimes, it appears, Nullary constructors can be encoded as Null as
    well as an empty array [not sure why one this!]. The Generic code, as of
    49befca, fails when a Null is
    passed for a nullary constructor. Add in a pattern match to fix this
    issue.
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 0 deletions.
  1. +1 −0  Data/Aeson/Generic.hs
View
1  Data/Aeson/Generic.hs
@@ -290,6 +290,7 @@ parseJSON_generic j = generic
decodeArgs c0 = go (numConstrArgs (resType generic) c0) c0
(constrFields c0)
where
+ go 0 c _ Null = construct c []
go 1 c [] jd = construct c [jd] -- unary constructor
go _ c [] (Array js) = construct c (V.toList js) -- no field names
-- FIXME? We could allow reading an array into a constructor
Something went wrong with that request. Please try again.