File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ module Data.Aeson.Types
36
36
, ToJSON (.. )
37
37
, KeyValue (.. )
38
38
, liftP2
39
+ , (<*>+)
39
40
, modifyFailure
40
41
, parserThrowError
41
42
, parserCatchError
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ module Data.Aeson.Types.Internal
44
44
, parseEither
45
45
, parseMaybe
46
46
, liftP2
47
+ , (<*>+)
47
48
, modifyFailure
48
49
, parserThrowError
49
50
, parserCatchError
@@ -339,14 +340,22 @@ apP d e = do
339
340
return (b a)
340
341
{-# INLINE apP #-}
341
342
342
- -- | A variant of 'liftA2' that lazily accumulates errors from both subparsers.
343
+ -- | A variant of 'Control.Applicative.liftA2' that lazily accumulates errors
344
+ -- from both subparsers.
343
345
liftP2 :: (a -> b -> c ) -> Parser a -> Parser b -> Parser c
344
346
liftP2 f pa pb = Parser $ \ path kf ks ->
345
347
runParser pa path
346
348
(\ (e :| es) -> kf (e :| es ++ runParser pb path NonEmpty. toList (const [] )))
347
349
(\ a -> runParser pb path kf (\ b -> ks (f a b)))
348
350
{-# INLINE liftP2 #-}
349
351
352
+ infixl 4 <*>+
353
+
354
+ -- | A variant of ('<*>') that lazily accumulates errors from both subparsers.
355
+ (<*>+) :: Parser (a -> b ) -> Parser a -> Parser b
356
+ (<*>+) = liftP2 id
357
+ {-# INLINE (<*>+) #-}
358
+
350
359
-- | A JSON \"object\" (key\/value map).
351
360
type Object = HashMap Text Value
352
361
You can’t perform that action at this time.
0 commit comments