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
I am testing the git.master version and got this error:
Object (fromList [("some-string",Null)])
aeson-example-simple: failed to parse field some-string: expected Text, encountered Null
I would expect that fromJSON would coerce Null to Nothing :: Maybe Text but it sees Null as a Type ( I tested it on both GHC 7.10.2 and 7.10.3 )
Which is a result of the following code:
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE OverloadedStrings #-}
import Data.Aeson
import Data.Text
data Some = Some {someString :: Maybe Text}
deriving Show
instance FromJSON Some where
parseJSON = withObject "Some" $ \o -> do
someString <- o .:? "some-string"
return Some{..}
a :: Value
a = object ([("some-string",Null)])
main = do
print a
case fromJSON $ a of
Error e -> error e
Success some -> print (some :: Some)
I am testing the git.master version and got this error:
I would expect that
fromJSON
would coerceNull
toNothing :: Maybe Text
but it seesNull
as aType
( I tested it on both GHC 7.10.2 and 7.10.3 )Which is a result of the following code:
and in
.cabal
I will investigate it a bit longer but if you have anything to suggest It would be awesome...
The text was updated successfully, but these errors were encountered: