on master help sign in
Explicitly export Options fields so they appear in documentation
61b889alyxia
Data/Aeson/Types.hs+16−1
@@ -104,7 +104,19 @@ module Data.Aeson.Types
104 , listParser
104 , listParser
105
105
106 -- * Generic and TH encoding configuration
106 -- * 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
108 , SumEncoding(..)
120 , SumEncoding(..)
109 , camelTo
121 , camelTo
110 , camelTo2
122 , camelTo2
@@ -124,3 +136,6 @@ import Data.Foldable (toList)
124foldable :: (Foldable t, ToJSON a) => t a -> Encoding
136foldable :: (Foldable t, ToJSON a) => t a -> Encoding
125foldable = toEncoding . toList
137foldable = toEncoding . toList
126{-# INLINE foldable #-}
138{-# INLINE foldable #-}
139+
140+-- $optionsFields
141+-- The functions here are in fact record fields of the 'Options' type.
Data/Aeson/Types/Internal.hs+3
@@ -531,6 +531,9 @@ parserCatchError (Parser p) handler = Parser $ \path kf ks ->
531--------------------------------------------------------------------------------
531--------------------------------------------------------------------------------
532
532
533-- | Options that specify how to encode\/decode your datatype to\/from JSON.
533-- | 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.
534data Options = Options
537data Options = Options
535 { fieldLabelModifier :: String -> String
538 { fieldLabelModifier :: String -> String
536 -- ^ Function applied to field labels.
539 -- ^ Function applied to field labels.