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
3636 , ToJSON (.. )
3737 , KeyValue (.. )
3838 , liftP2
39+ , (<*>+)
3940 , modifyFailure
4041 , parserThrowError
4142 , parserCatchError
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ module Data.Aeson.Types.Internal
4444 , parseEither
4545 , parseMaybe
4646 , liftP2
47+ , (<*>+)
4748 , modifyFailure
4849 , parserThrowError
4950 , parserCatchError
@@ -339,14 +340,22 @@ apP d e = do
339340 return (b a)
340341{-# INLINE apP #-}
341342
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.
343345liftP2 :: (a -> b -> c ) -> Parser a -> Parser b -> Parser c
344346liftP2 f pa pb = Parser $ \ path kf ks ->
345347 runParser pa path
346348 (\ (e :| es) -> kf (e :| es ++ runParser pb path NonEmpty. toList (const [] )))
347349 (\ a -> runParser pb path kf (\ b -> ks (f a b)))
348350{-# INLINE liftP2 #-}
349351
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+
350359-- | A JSON \"object\" (key\/value map).
351360type Object = HashMap Text Value
352361
You can’t perform that action at this time.
0 commit comments