on master help sign in
Update Serialize/Unbox docs
1597f79Harendra Kumar
core/src/Streamly/Internal/Data/Serialize/TH.hs+6−5
@@ -449,9 +449,9 @@ deriveSerializeInternal conf headTy cons next = do
449-- | @deriveSerializeWith config instance-dec@ generates a template Haskell
449-- | @deriveSerializeWith config instance-dec@ generates a template Haskell
450-- splice consisting of a declaration of a 'Serialize' instance. @instance-dec@
450-- splice consisting of a declaration of a 'Serialize' instance. @instance-dec@
451-- is a template Haskell declaration splice consisting of a standard Haskell
451-- is a template Haskell declaration splice consisting of a standard Haskell
452−-- instance declaration without the type class methods. The type class methods
452+-- instance declaration without the type class methods (e.g. @[d|instance
453+-- Serialize a => Serialize (Maybe a)|]@). The type class methods for the given
453−-- for the given instance are generated according to the supplied @config@
454+-- instance are generated according to the supplied @config@ parameter.
454−-- parameter.
455--
455--
456-- Usage:
456-- Usage:
457--
457--
@@ -501,8 +501,9 @@ deriveSerializeWith conf mDecs = do
501 go (AppT l _) = go l
501 go (AppT l _) = go l
502 go _ = errorMessage dec
502 go _ = errorMessage dec
503
503
504−-- | Given a 'Serialize' instance declaration splice without the methods,
504+-- | Given an 'Serialize' instance declaration splice without the methods (e.g.
505+-- @[d|instance Serialize a => Serialize (Maybe a)|]@), generate an instance
505−-- generate a full instance declaration including all the type class methods.
506+-- declaration including all the type class method implementations.
506--
507--
507-- >>> deriveSerialize = deriveSerializeWith serializeConfig
508-- >>> deriveSerialize = deriveSerializeWith serializeConfig
508--
509--
core/src/Streamly/Internal/Data/Serialize/TH/Bottom.hs+2−2
@@ -185,8 +185,8 @@ encodeRecordFields v cfg = cfg {cfgRecordSyntaxWithHeader = v}
185-- | The default configuration settings are:
185-- | The default configuration settings are:
186--
186--
187-- * 'inlineSize' 'Nothing'
187-- * 'inlineSize' 'Nothing'
188−-- * 'inlineSerialize' 'Just Inline'
188+-- * 'inlineSerialize' (Just Inline)
189−-- * 'inlineDeserialize' 'Just Inline'
189+-- * 'inlineDeserialize' (Just Inline)
190--
190--
191serializeConfig :: SerializeConfig
191serializeConfig :: SerializeConfig
192serializeConfig =
192serializeConfig =
core/src/Streamly/Internal/Data/Serialize/Type.hs+1−1
@@ -98,7 +98,7 @@ import GHC.Exts
98--
98--
99-- @
99-- @
100-- import Streamly.Data.Serialize (deriveSerialize)
100-- import Streamly.Data.Serialize (deriveSerialize)
101−-- \$(deriveSerialize ''Object)
101+-- \$(deriveSerialize [d|instance Serialize Object|])
102-- @
102-- @
103--
103--
104-- See 'Streamly.Data.Serialize.deriveSerialize' and
104-- See 'Streamly.Data.Serialize.deriveSerialize' and
core/src/Streamly/Internal/Data/Unbox.hs+2−3
@@ -385,11 +385,10 @@ unpin arr@(MutableByteArray marr#) =
385--
385--
386-- @
386-- @
387-- import Streamly.Data.Serialize (deriveUnbox)
387-- import Streamly.Data.Serialize (deriveUnbox)
388−-- \$(deriveUnbox ''Object)
388+-- \$(deriveUnbox [d|instance Unbox Object|])
389-- @
389-- @
390--
390--
391−-- See 'Streamly.Data.Serialize.deriveUnbox' and
391+-- See 'Streamly.Data.Serialize.deriveUnbox' for more information on deriving
392−-- 'Streamly.Data.Serialize.deriveUnboxWith' for more information on deriving
393-- using Template Haskell.
392-- using Template Haskell.
394--
393--
395-- If you want to write the instance manually:
394-- If you want to write the instance manually:
core/src/Streamly/Internal/Data/Unbox/TH.hs+3−2
@@ -425,8 +425,9 @@ deriveUnboxInternal headTy cons mkDec = do
425 ]
425 ]
426 mkDec methods
426 mkDec methods
427
427
428−-- | Given an 'Unbox' instance declaration splice without the methods,
428+-- | Given an 'Unbox' instance declaration splice without the methods (e.g.
429+-- @[d|instance Unbox a => Unbox (Maybe a)|]@), generate an instance
429−-- generate a full instance declaration including all the type class methods.
430+-- declaration including all the type class method implementations.
430--
431--
431-- Usage:
432-- Usage:
432--
433--