Data.ByteString.Builder
的核心数据类型是
newtype Builder = Builder (forall r. BuildStep r -> BuildStep r)
type BuildStep a = BufferRange -> IO (BuildSignal a)
data BuildSignal a =
Done {-# UNPACK #-} !(Ptr Word8) a
| BufferFull
{-# UNPACK #-} !Int
{-# UNPACK #-} !(Ptr Word8)
(BuildStep a)
| InsertChunk
{-# UNPACK #-} !(Ptr Word8)
S.ByteString
(BuildStep a)
类型参数(
r
或a
)起什么作用? 最佳答案
不需要。作为证明,我有created a fork,它不会更改任何公共(public)API(仅更改名为Internal
的模块的API),但是会删除此类型参数。