File tree 3 files changed +12
-1
lines changed
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
8
8
, (<*>+)
9
9
) where
10
10
11
+ import Prelude ()
12
+ import Prelude.Compat
13
+
11
14
import Data.Aeson.Types.Internal (Parser (.. ), runParser )
12
15
import Data.List.NonEmpty (NonEmpty ((:|) ))
13
16
import qualified Data.List.NonEmpty as NonEmpty
Original file line number Diff line number Diff line change @@ -1439,7 +1439,7 @@ instance FromJSON Scientific where
1439
1439
instance FromJSON1 DList. DList where
1440
1440
liftParseJSON p _ = withArray " DList a" $
1441
1441
fmap DList. fromList .
1442
- Tr. sequence . zipWith (parseIndexedJSON p) [0 .. ] . V. toList
1442
+ accSequence . zipWith (parseIndexedJSON p) [0 .. ] . V. toList
1443
1443
{-# INLINE liftParseJSON #-}
1444
1444
1445
1445
instance (FromJSON a ) => FromJSON (DList. DList a ) where
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import Prelude ()
6
6
import Prelude.Compat hiding (seq )
7
7
8
8
import Data.Aeson
9
+ import Data.DList (DList )
9
10
import Data.Aeson.Parser.Internal
10
11
import Data.Aeson.Types ()
11
12
import Data.Aeson.Internal
@@ -24,6 +25,7 @@ tests = testGroup "Error accumulation" [
24
25
testCase " Seq" seq
25
26
, testCase " Vector" vector
26
27
, testCase " NonEmpty" nonEmpty
28
+ , testCase " DList" dlist
27
29
]
28
30
29
31
decoder :: FromJSON a
@@ -48,3 +50,9 @@ nonEmpty = do
48
50
let res = decoder " [true, null]" :: Either (NonEmpty (JSONPath , String )) (NL. NonEmpty Int )
49
51
let message i s = ([Index i], " expected Int, encountered " <> s)
50
52
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