Skip to content

Commit 2248895

Browse files
authored
Merge pull request #582 from Lysxia/options-doc
Make Options fields appear in documentation
2 parents e3d77f0 + 027c567 commit 2248895

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed

Data/Aeson.hs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,22 @@ module Data.Aeson
8787
, genericLiftToEncoding
8888
, genericParseJSON
8989
, genericLiftParseJSON
90+
-- ** Generic and TH encoding configuration
91+
, Options
9092
, defaultOptions
93+
-- *** Options fields
94+
-- $optionsFields
95+
, fieldLabelModifier
96+
, constructorTagModifier
97+
, allNullaryToStringTag
98+
, omitNothingFields
99+
, sumEncoding
100+
, unwrapUnaryRecords
101+
, tagSingleConstructors
102+
-- *** Options utilities
103+
, SumEncoding(..)
104+
, camelTo2
105+
, defaultTaggedObject
91106

92107
-- * Inspecting @'Value's@
93108
, withObject

Data/Aeson/Types.hs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,19 @@ module Data.Aeson.Types
104104
, listParser
105105

106106
-- * Generic and TH encoding configuration
107-
, Options(..)
107+
, Options
108+
109+
-- ** Options fields
110+
-- $optionsFields
111+
, fieldLabelModifier
112+
, constructorTagModifier
113+
, allNullaryToStringTag
114+
, omitNothingFields
115+
, sumEncoding
116+
, unwrapUnaryRecords
117+
, tagSingleConstructors
118+
119+
-- ** Options utilities
108120
, SumEncoding(..)
109121
, camelTo
110122
, camelTo2
@@ -124,3 +136,6 @@ import Data.Foldable (toList)
124136
foldable :: (Foldable t, ToJSON a) => t a -> Encoding
125137
foldable = toEncoding . toList
126138
{-# INLINE foldable #-}
139+
140+
-- $optionsFields
141+
-- The functions here are in fact record fields of the 'Options' type.

Data/Aeson/Types/Internal.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,9 @@ parserCatchError (Parser p) handler = Parser $ \path kf ks ->
531531
--------------------------------------------------------------------------------
532532

533533
-- | Options that specify how to encode\/decode your datatype to\/from JSON.
534+
--
535+
-- Options can be set using record syntax on 'defaultOptions' with the fields
536+
-- below.
534537
data Options = Options
535538
{ fieldLabelModifier :: String -> String
536539
-- ^ Function applied to field labels.

0 commit comments

Comments
 (0)