Skip to content

Commit 3e0e302

Browse files
committed
Improve comments about with* combinators
1 parent 6b68815 commit 3e0e302

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

Data/Aeson/Types/FromJSON.hs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -621,43 +621,44 @@ instance (FromJSON a) => FromJSON [a] where
621621
-- Functions
622622
-------------------------------------------------------------------------------
623623

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.
626626
withObject :: String -> (Object -> Parser a) -> Value -> Parser a
627627
withObject _ f (Object obj) = f obj
628628
withObject expected _ v = typeMismatch expected v
629629
{-# INLINE withObject #-}
630630

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.
633633
withText :: String -> (Text -> Parser a) -> Value -> Parser a
634634
withText _ f (String txt) = f txt
635635
withText expected _ v = typeMismatch expected v
636636
{-# INLINE withText #-}
637637

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.
640640
withArray :: String -> (Array -> Parser a) -> Value -> Parser a
641641
withArray _ f (Array arr) = f arr
642642
withArray expected _ v = typeMismatch expected v
643643
{-# INLINE withArray #-}
644644

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.
647647
withNumber :: String -> (Number -> Parser a) -> Value -> Parser a
648648
withNumber expected f = withScientific expected (f . scientificToNumber)
649649
{-# INLINE withNumber #-}
650650
{-# DEPRECATED withNumber "Use withScientific instead" #-}
651651

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.
654655
withScientific :: String -> (Scientific -> Parser a) -> Value -> Parser a
655656
withScientific _ f (Number scientific) = f scientific
656657
withScientific expected _ v = typeMismatch expected v
657658
{-# INLINE withScientific #-}
658659

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.
661662
withBool :: String -> (Bool -> Parser a) -> Value -> Parser a
662663
withBool _ f (Bool arr) = f arr
663664
withBool expected _ v = typeMismatch expected v

0 commit comments

Comments
 (0)