File tree Expand file tree Collapse file tree 3 files changed +12
-1
lines changed Expand file tree Collapse file tree 3 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,9 @@ module Data.Aeson.AccParser
88 , (<*>+)
99 ) where
1010
11+ import Prelude ()
12+ import Prelude.Compat
13+
1114import Data.Aeson.Types.Internal (Parser (.. ), runParser )
1215import Data.List.NonEmpty (NonEmpty ((:|) ))
1316import qualified Data.List.NonEmpty as NonEmpty
Original file line number Diff line number Diff line change @@ -1439,7 +1439,7 @@ instance FromJSON Scientific where
14391439instance FromJSON1 DList. DList where
14401440 liftParseJSON p _ = withArray " DList a" $
14411441 fmap DList. fromList .
1442- Tr. sequence . zipWith (parseIndexedJSON p) [0 .. ] . V. toList
1442+ accSequence . zipWith (parseIndexedJSON p) [0 .. ] . V. toList
14431443 {-# INLINE liftParseJSON #-}
14441444
14451445instance (FromJSON a ) => FromJSON (DList. DList a ) where
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import Prelude ()
66import Prelude.Compat hiding (seq )
77
88import Data.Aeson
9+ import Data.DList (DList )
910import Data.Aeson.Parser.Internal
1011import Data.Aeson.Types ()
1112import Data.Aeson.Internal
@@ -24,6 +25,7 @@ tests = testGroup "Error accumulation" [
2425 testCase " Seq" seq
2526 , testCase " Vector" vector
2627 , testCase " NonEmpty" nonEmpty
28+ , testCase " DList" dlist
2729 ]
2830
2931decoder :: FromJSON a
@@ -48,3 +50,9 @@ nonEmpty = do
4850 let res = decoder " [true, null]" :: Either (NonEmpty (JSONPath , String )) (NL. NonEmpty Int )
4951 let message i s = ([Index i], " expected Int, encountered " <> s)
5052 res @=? Left (NL. fromList [message 0 " Boolean" , message 1 " Null" ])
53+
54+ dlist :: Assertion
55+ dlist = do
56+ let res = decoder " [true, null]" :: Either (NonEmpty (JSONPath , String )) (DList Int )
57+ let message i s = ([Index i], " expected Int, encountered " <> s)
58+ res @=? Left (NL. fromList [message 0 " Boolean" , message 1 " Null" ])
You can’t perform that action at this time.
0 commit comments