【发布时间】:2010-03-09 23:12:46
【问题描述】:
尝试使用 Data.Binary.Get 和 ByteString 但不了解发生了什么。我的代码如下:
getSegmentParams :: Get (Int, L.ByteString)
getSegmentParams = do
seglen <- liftM fromIntegral getWord16be
params <- getByteString (seglen - 2)
return (seglen, params)
对于返回元组的第三项,即有效负载,我得到以下错误:
Couldn't match expected type `L.ByteString'
against inferred type `bytestring-0.9.1.4:Data.ByteString.Internal.ByteString'
请有人向我解释 Data.Binary.Get 和 ByteStrings 之间的交互,以及我可以如何做我想做的事情。谢谢。
【问题讨论】:
标签: haskell bytestring