You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
data Foo = Foo { bar :: Maybe Int } deriving Show
$(deriveJSON defaultOptions{omitNothingFields=True} ''Foo)
Error: Couldn't match expected type `Text' with actual type `Builder'
In the first argument of `(.=)', namely `text (pack "bar")'
In the first argument of `(<$>)', namely `(text (pack "bar") .=)'
Maybe fallout related to #287? But here's the weird thing, I actually discovered this first:
type Synonym = Maybe Int
data Foo = Foo { bar :: Synonym } deriving Show
$(deriveJSON defaultOptions{omitNothingFields=True} ''Foo)
>>> decode "{}" :: Maybe Foo
Just (Foo {bar = Nothing})
>>> encode $ Foo Nothing
"{\"bar\":null}"
omitNothingFields wasn't omitting them. I removed the type for sanity checking, and it exploded! (I was working with more complex types, but this simple example shows the same behavior.) So this might be two bugs; for some reason a synonym prevents the compile failure, but still has wrong behavior.
Everything works fine when omitNothingFields=False.
The text was updated successfully, but these errors were encountered:
Maybe fallout related to #287? But here's the weird thing, I actually discovered this first:
omitNothingFields
wasn't omitting them. I removed thetype
for sanity checking, and it exploded! (I was working with more complex types, but this simple example shows the same behavior.) So this might be two bugs; for some reason a synonym prevents the compile failure, but still has wrong behavior.Everything works fine when
omitNothingFields=False
.The text was updated successfully, but these errors were encountered: