@@ -80,11 +80,17 @@ import Streamly.Internal.Data.Unbox.TH (DataCon(..))
8080-- no inline specific pragma let's GHC decide whether to put the code in
8181-- interface file or not.
8282
83−-- | Configuration to control how the 'Serialize' instance is generated. Use
84−-- 'serializeConfig' and config setter functions to generate desired Config. For
85−-- example:
83+-- | Configuration to control how the 'Serialize' instance is generated. The
84+-- configuration is opaque and is modified by composing config modifier
85+-- functions, for example:
8686--
87−-- >>> (inlineAddSizeTo (Just Inline)) . (inlineSerializeAt (Just Inlinable)) serializeConfig
87+-- >>> (inlineSerializeAt (Just NoInline)) . (inlineSerializeAt (Just Inlinable))
88+--
89+-- The default configuration settings are:
90+--
91+-- * 'inlineAddSizeTo' Nothing
92+-- * 'inlineSerializeAt' (Just Inline)
93+-- * 'inlineDeserializeAt' (Just Inline)
8894--
8995data SerializeConfig =
9096 SerializeConfig
@@ -95,19 +101,19 @@ data SerializeConfig =
95101 , cfgRecordSyntaxWithHeader :: Bool
96102 }
97103
98−-- | How should we inline the 'addSizeTo' function? The default in 'serializeConfig'
99−-- is 'Nothing' which means left to the compiler. Forcing inline on @addSizeTo@
100−-- function actually worsens some benchmarks and improves none.
104+-- | How should we inline the 'addSizeTo' function? The default is 'Nothing'
105+-- which means left to the compiler. Forcing inline on @addSizeTo@ function
106+-- actually worsens some benchmarks and improves none.
101107inlineAddSizeTo :: Maybe Inline -> SerializeConfig -> SerializeConfig
102108inlineAddSizeTo v cfg = cfg {cfgInlineSize = v}
103109
104110-- XXX Should we make the default Inlinable instead?
105111
106−-- | How should we inline the 'serialize' function? The default in
107−-- 'serializeConfig' is 'Just Inline'. However, aggressive inlining can bloat
108−-- the code and increase in compilation times when there are big functions and
109−-- too many nesting levels so you can change it accordingly. A 'Nothing' value
110−-- leaves the decision to the compiler.
112+-- | How should we inline the 'serialize' function? The default 'Just Inline'.
113+-- However, aggressive inlining can bloat the code and increase in compilation
114+-- times when there are big functions and too many nesting levels so you can
115+-- change it accordingly. A 'Nothing' value leaves the decision to the
116+-- compiler.
111117inlineSerializeAt :: Maybe Inline -> SerializeConfig -> SerializeConfig
112118inlineSerializeAt v cfg = cfg {cfgInlineSerialize = v}
113119
@@ -182,12 +188,6 @@ encodeConstrNames v cfg = cfg {cfgConstructorTagAsString = v}
182188encodeRecordFields :: Bool -> SerializeConfig -> SerializeConfig
183189encodeRecordFields v cfg = cfg {cfgRecordSyntaxWithHeader = v}
184190
185−-- | The default configuration settings are:
186−--
187−-- * 'inlineAddSizeTo' 'Nothing'
188−-- * 'inlineSerializeAt' (Just Inline)
189−-- * 'inlineDeserializeAt' (Just Inline)
190−--
191191serializeConfig :: SerializeConfig
192192serializeConfig =
193193 SerializeConfig