From c792103df327986d3b5deee449d2d319e1a4db2b Mon Sep 17 00:00:00 2001 From: Li-yao Xia Date: Thu, 9 Jul 2026 09:01:22 +0200 Subject: [PATCH] doc: Fix hyperlinking errors --- src/Data/Aeson.hs | 7 +++++-- src/Data/Aeson/Key.hs | 7 +------ src/Data/Aeson/KeyMap.hs | 8 ++++---- src/Data/Aeson/TH.hs | 2 +- src/Data/Aeson/Text.hs | 6 +++--- src/Data/Aeson/Types/FromJSON.hs | 2 +- src/Data/Aeson/Types/Internal.hs | 8 +++++--- src/Data/Aeson/Types/ToJSON.hs | 2 +- 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/Data/Aeson.hs b/src/Data/Aeson.hs index b7e4dcabf..8f19c2bc4 100644 --- a/src/Data/Aeson.hs +++ b/src/Data/Aeson.hs @@ -374,7 +374,7 @@ throwDecodeStrict' = throwDecodeStrict -- -- \-- this encodes directly to a bytestring Builder -- 'toEncoding' (Person name age) = --- 'pairs' (\"name\" '.=' 'name' '<>' \"age\" '.=' age) +-- 'pairs' (\"name\" '.=' name '<>' \"age\" '.=' age) -- @ -- -- We can now encode a value like so: @@ -524,7 +524,7 @@ throwDecodeStrict' = throwDecodeStrict -- -- @ -- 'toEncoding' (Person name age) = --- 'pairs' (\"name\" '.=' 'name' '<>' \"age\" '.=' age) +-- 'pairs' (\"name\" '.=' name '<>' \"age\" '.=' age) -- @ -- -- Any container type that implements 'Foldable' can be encoded to a @@ -566,3 +566,6 @@ throwDecodeStrict' = throwDecodeStrict -- , -- and -- (where the relevant parsers are defined). + +-- $optionsFields +-- The functions here are in fact record fields of the 'Options' type. diff --git a/src/Data/Aeson/Key.hs b/src/Data/Aeson/Key.hs index 74882f6d9..73890bbcb 100644 --- a/src/Data/Aeson/Key.hs +++ b/src/Data/Aeson/Key.hs @@ -55,12 +55,7 @@ fromText = Key toText :: Key -> Text toText = unKey --- | @'coercing r1 r2'@ will evaluate to @r1@ if 'Key' is 'Coercible' to 'Text', --- and to @r2@ otherwise. --- --- Using 'coercing' we can make more efficient implementations --- when 'Key' is backed up by 'Text' without exposing internals. --- +-- | Partially exposed coercion for forwards compatibility. coercionToText :: Maybe (Coercion Key Text) coercionToText = Just Coercion {-# INLINE coercionToText #-} diff --git a/src/Data/Aeson/KeyMap.hs b/src/Data/Aeson/KeyMap.hs index ac95af60b..d374a045c 100644 --- a/src/Data/Aeson/KeyMap.hs +++ b/src/Data/Aeson/KeyMap.hs @@ -138,7 +138,7 @@ import qualified Witherable as W -- Map ------------------------------------------------------------------------------- --- | A map from JSON key type 'Key' to 'v'. +-- | A map from JSON key type 'Key' to @v@. newtype KeyMap v = KeyMap { unKeyMap :: Map Key v } deriving (Eq, Ord, Data, Functor) @@ -268,7 +268,7 @@ difference :: KeyMap v -> KeyMap v' -> KeyMap v difference tm1 tm2 = KeyMap (M.difference (unKeyMap tm1) (unKeyMap tm2)) -- | The (left-biased) union of two maps. It prefers the first map when duplicate --- keys are encountered, i.e. ('union' == 'unionWith' 'const'). +-- keys are encountered, i.e. ('union' == 'unionWith' 'Prelude.const'). union :: KeyMap v -> KeyMap v -> KeyMap v union (KeyMap x) (KeyMap y) = KeyMap (M.union x y) @@ -352,7 +352,7 @@ import Data.List (sortBy) import Data.Ord (comparing) import Prelude (fst) --- | A map from JSON key type 'Key' to 'v'. +-- | A map from JSON key type 'Key' to @v@. newtype KeyMap v = KeyMap { unKeyMap :: HashMap Key v } deriving (Eq, Ord, Data, Functor) @@ -477,7 +477,7 @@ difference :: KeyMap v -> KeyMap v' -> KeyMap v difference tm1 tm2 = KeyMap (H.difference (unKeyMap tm1) (unKeyMap tm2)) -- | The (left-biased) union of two maps. It prefers the first map when duplicate --- keys are encountered, i.e. ('union' == 'unionWith' 'const'). +-- keys are encountered, i.e. ('union' == 'unionWith' 'Prelude.const'). union :: KeyMap v -> KeyMap v -> KeyMap v union (KeyMap x) (KeyMap y) = KeyMap (H.union x y) diff --git a/src/Data/Aeson/TH.hs b/src/Data/Aeson/TH.hs index b4f3636a2..6f298cfdc 100644 --- a/src/Data/Aeson/TH.hs +++ b/src/Data/Aeson/TH.hs @@ -591,7 +591,7 @@ deriveFromJSON1 = deriveFromJSONCommon fromJSON1Class deriveFromJSON2 :: Options -- ^ Encoding options. -> Name - -- ^ Name of the type for which to generate a 'FromJSON3' instance + -- ^ Name of the type for which to generate a 'FromJSON2' instance -- declaration. -> Q [Dec] deriveFromJSON2 = deriveFromJSONCommon fromJSON2Class diff --git a/src/Data/Aeson/Text.hs b/src/Data/Aeson/Text.hs index a64d34fda..b29e45a67 100644 --- a/src/Data/Aeson/Text.hs +++ b/src/Data/Aeson/Text.hs @@ -10,7 +10,7 @@ -- Portability: portable -- -- Most frequently, you'll probably want to encode straight to UTF-8 --- (the standard JSON encoding) using 'encode'. +-- (the standard JSON encoding) using 'Data.Aeson.encode'. -- -- You can use the conversions to 'Builder's when embedding JSON messages as -- parts of a protocol. @@ -47,8 +47,8 @@ encodeToLazyText = LT.decodeUtf8 . encodingToLazyByteString . toEncoding -- embedded efficiently in a text-based protocol. -- -- If you are going to immediately encode straight to a --- 'L.ByteString', it is more efficient to use 'encode' (lazy ByteString) --- or @'fromEncoding' . 'toEncoding'@ (ByteString.Builder) instead. +-- 'Data.ByteString.Lazy.ByteString', it is more efficient to use 'Data.Aeson.encode' (lazy ByteString) +-- or @'Data.Aeson.fromEncoding' . 'toEncoding'@ ('Builder') instead. -- -- /Note:/ Uses 'toJSON' encodeToTextBuilder :: ToJSON a => a -> Builder diff --git a/src/Data/Aeson/Types/FromJSON.hs b/src/Data/Aeson/Types/FromJSON.hs index 8a8f2a96e..827ed6c60 100644 --- a/src/Data/Aeson/Types/FromJSON.hs +++ b/src/Data/Aeson/Types/FromJSON.hs @@ -1322,7 +1322,7 @@ instance {-# OVERLAPPING #-} FromTaggedObject' arity U1 False where -------------------------------------------------------------------------------- -- | Constructors need to be decoded differently depending on whether they're --- a record or not. This distinction is made by 'ConsParseJSON'. +-- a record or not. This distinction is made by 'ConsFromJSON'. class ConsFromJSON arity f where consParseJSON :: ConName :* TypeName :* Options :* FromArgs arity a diff --git a/src/Data/Aeson/Types/Internal.hs b/src/Data/Aeson/Types/Internal.hs index a0f6ac103..e2668dd74 100644 --- a/src/Data/Aeson/Types/Internal.hs +++ b/src/Data/Aeson/Types/Internal.hs @@ -488,7 +488,9 @@ arbPartition k = case compare k 1 of -- The ordering is total, consistent with 'Eq' instance. -- However, nothing else about the ordering is specified, -- and it may change from environment to environment and version to version --- of either this package or its dependencies ('hashable' and 'unordered-containers'). +-- of either this package or its dependencies +-- ( and +-- ). -- -- @since 1.5.2.0 deriving instance Ord Value @@ -731,7 +733,7 @@ data Options = Options -- 'allowOmittedFieds' controls parsing behavior. , allowOmittedFields :: Bool -- ^ If 'True', missing fields of a record will be filled - -- with 'omittedField' values (if they are 'Just'). + -- with 'Data.Aeson.FromJSON.omittedField' values (if they are 'Just'). -- If 'False', all fields will required to present in the record object. , sumEncoding :: SumEncoding -- ^ Specifies how to encode constructors of a sum datatype. @@ -885,7 +887,7 @@ defaultJSONKeyOptions = JSONKeyOptions id -- | Converts from CamelCase to another lower case, interspersing -- the character between all capital letters and their previous -- entries, except those capital letters that appear together, --- like 'API'. +-- like \"API\". -- -- For use by Aeson template haskell calls. -- diff --git a/src/Data/Aeson/Types/ToJSON.hs b/src/Data/Aeson/Types/ToJSON.hs index 450f3f3b3..9fcd54882 100644 --- a/src/Data/Aeson/Types/ToJSON.hs +++ b/src/Data/Aeson/Types/ToJSON.hs @@ -467,7 +467,7 @@ instance value ~ Value => KeyValueOmit Value (KM.KeyMap value) where -- > deriving (Show,Read,Eq,Ord) -- -- It is possible to get the 'ToJSONKey' instance for free as we did --- with 'Foo'. However, in this case, we have a natural way to go to +-- with @Foo@. However, in this case, we have a natural way to go to -- and from 'Text' that does not require any escape sequences. So -- 'ToJSONKeyText' can be used instead of 'ToJSONKeyValue' to encode maps -- as objects instead of arrays of pairs. This instance may be