@@ -621,43 +621,44 @@ instance (FromJSON a) => FromJSON [a] where
621
621
-- Functions
622
622
-------------------------------------------------------------------------------
623
623
624
- -- | @withObject expected f value@ applies @f@ to the 'Object' when @value@ is an @Object @
625
- -- and fails using @'typeMismatch' expected@ otherwise.
624
+ -- | @' withObject' expected f value@ applies @f@ to the 'Object' when @value@
625
+ -- is an 'Object' and fails using @'typeMismatch' expected@ otherwise.
626
626
withObject :: String -> (Object -> Parser a ) -> Value -> Parser a
627
627
withObject _ f (Object obj) = f obj
628
628
withObject expected _ v = typeMismatch expected v
629
629
{-# INLINE withObject #-}
630
630
631
- -- | @withText expected f value@ applies @f@ to the 'Text' when @value@ is a @String@
632
- -- and fails using @'typeMismatch' expected@ otherwise.
631
+ -- | @' withText' expected f value@ applies @f@ to the 'Text' when @value@ is a
632
+ -- 'String' and fails using @'typeMismatch' expected@ otherwise.
633
633
withText :: String -> (Text -> Parser a ) -> Value -> Parser a
634
634
withText _ f (String txt) = f txt
635
635
withText expected _ v = typeMismatch expected v
636
636
{-# INLINE withText #-}
637
637
638
- -- | @withArray expected f value@ applies @f@ to the 'Array' when @value@ is an @Array@
639
- -- and fails using @'typeMismatch' expected@ otherwise.
638
+ -- | @' withArray' expected f value@ applies @f@ to the 'Array' when @value@ is
639
+ -- an 'Array' and fails using @'typeMismatch' expected@ otherwise.
640
640
withArray :: String -> (Array -> Parser a ) -> Value -> Parser a
641
641
withArray _ f (Array arr) = f arr
642
642
withArray expected _ v = typeMismatch expected v
643
643
{-# INLINE withArray #-}
644
644
645
- -- | @withNumber expected f value@ applies @f@ to the 'Number' when @value@ is a 'Number'.
646
- -- and fails using @'typeMismatch' expected@ otherwise.
645
+ -- | @' withNumber' expected f value@ applies @f@ to the 'Number' when @value@
646
+ -- is a 'Number' and fails using @'typeMismatch' expected@ otherwise.
647
647
withNumber :: String -> (Number -> Parser a ) -> Value -> Parser a
648
648
withNumber expected f = withScientific expected (f . scientificToNumber)
649
649
{-# INLINE withNumber #-}
650
650
{-# DEPRECATED withNumber "Use withScientific instead" #-}
651
651
652
- -- | @withScientific expected f value@ applies @f@ to the 'Scientific' number when @value@ is a 'Number'.
653
- -- and fails using @'typeMismatch' expected@ otherwise.
652
+ -- | @'withScientific' expected f value@ applies @f@ to the 'Scientific' number
653
+ -- when @value@ is a 'Number' and fails using @'typeMismatch' expected@
654
+ -- otherwise.
654
655
withScientific :: String -> (Scientific -> Parser a ) -> Value -> Parser a
655
656
withScientific _ f (Number scientific) = f scientific
656
657
withScientific expected _ v = typeMismatch expected v
657
658
{-# INLINE withScientific #-}
658
659
659
- -- | @withBool expected f value@ applies @f@ to the 'Bool' when @value@ is a @Bool@
660
- -- and fails using @'typeMismatch' expected@ otherwise.
660
+ -- | @' withBool' expected f value@ applies @f@ to the 'Bool' when @value@ is a
661
+ -- 'Bool' and fails using @'typeMismatch' expected@ otherwise.
661
662
withBool :: String -> (Bool -> Parser a ) -> Value -> Parser a
662
663
withBool _ f (Bool arr) = f arr
663
664
withBool expected _ v = typeMismatch expected v
0 commit comments