on master help sign in
Update Serialize/Unbox docs
commit1597f79cce832bf683387ab27a806e9686d7dd91 authorHarendra Kumar <harendra@composewell.com> dateThu 23 Nov 2023, 00:58 (3 years ago) parent784233d
5 files changed+14−13
core/src/Streamly/Internal/Data/Serialize/TH.hs+6−5 core/src/Streamly/Internal/Data/Serialize/TH/Bottom.hs+2−2 core/src/Streamly/Internal/Data/Serialize/Type.hs+1−1 core/src/Streamly/Internal/Data/Unbox.hs+2−3 core/src/Streamly/Internal/Data/Unbox/TH.hs+3−2
core/src/Streamly/Internal/Data/Serialize/TH.hs+6−5
@@ -449,9 +449,9 @@ deriveSerializeInternal conf headTy cons next = do
449449-- | @deriveSerializeWith config instance-dec@ generates a template Haskell
450450-- splice consisting of a declaration of a 'Serialize' instance. @instance-dec@
451451-- is a template Haskell declaration splice consisting of a standard Haskell
452−-- instance declaration without the type class methods. The type class methods
453−-- for the given instance are generated according to the supplied @config@
454−-- parameter.
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
454+-- instance are generated according to the supplied @config@ parameter.
455455--
456456-- Usage:
457457--
@@ -501,8 +501,9 @@ deriveSerializeWith conf mDecs = do
501501 go (AppT l _) = go l
502502 go _ = errorMessage dec
503503
504−-- | Given a 'Serialize' instance declaration splice without the methods,
505−-- generate a full instance declaration including all the type class methods.
504+-- | Given an 'Serialize' instance declaration splice without the methods (e.g.
505+-- @[d|instance Serialize a => Serialize (Maybe a)|]@), generate an instance
506+-- declaration including all the type class method implementations.
506507--
507508-- >>> deriveSerialize = deriveSerializeWith serializeConfig
508509--
core/src/Streamly/Internal/Data/Serialize/TH/Bottom.hs+2−2
@@ -185,8 +185,8 @@ encodeRecordFields v cfg = cfg {cfgRecordSyntaxWithHeader = v}
185185-- | The default configuration settings are:
186186--
187187-- * 'inlineSize' 'Nothing'
188−-- * 'inlineSerialize' 'Just Inline'
189−-- * 'inlineDeserialize' 'Just Inline'
188+-- * 'inlineSerialize' (Just Inline)
189+-- * 'inlineDeserialize' (Just Inline)
190190--
191191serializeConfig :: SerializeConfig
192192serializeConfig =
core/src/Streamly/Internal/Data/Serialize/Type.hs+1−1
@@ -98,7 +98,7 @@ import GHC.Exts
9898--
9999-- @
100100-- import Streamly.Data.Serialize (deriveSerialize)
101−-- \$(deriveSerialize ''Object)
101+-- \$(deriveSerialize [d|instance Serialize Object|])
102102-- @
103103--
104104-- See 'Streamly.Data.Serialize.deriveSerialize' and
core/src/Streamly/Internal/Data/Unbox.hs+2−3
@@ -385,11 +385,10 @@ unpin arr@(MutableByteArray marr#) =
385385--
386386-- @
387387-- import Streamly.Data.Serialize (deriveUnbox)
388−-- \$(deriveUnbox ''Object)
388+-- \$(deriveUnbox [d|instance Unbox Object|])
389389-- @
390390--
391−-- See 'Streamly.Data.Serialize.deriveUnbox' and
392−-- 'Streamly.Data.Serialize.deriveUnboxWith' for more information on deriving
391+-- See 'Streamly.Data.Serialize.deriveUnbox' for more information on deriving
393392-- using Template Haskell.
394393--
395394-- 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
425425 ]
426426 mkDec methods
427427
428−-- | Given an 'Unbox' instance declaration splice without the methods,
429−-- generate a full instance declaration including all the type class methods.
428+-- | Given an 'Unbox' instance declaration splice without the methods (e.g.
429+-- @[d|instance Unbox a => Unbox (Maybe a)|]@), generate an instance
430+-- declaration including all the type class method implementations.
430431--
431432-- Usage:
432433--