1
为ByteString文档给出了下面的代码示例:转换文本字符数以Word8
breakByte :: Word8 -> ByteString -> (ByteString, ByteString)
breakByte 'c' "abcd"
然而,当我写的一样,我得到以下错误(ideone):
Couldn't match expected type `GHC.Word.Word8'
with actual type `Char'
当然'c'
是一个Char
,而不是Word8
。据推测他们正在使用一些扩展,允许fromInteger
样式函数在Char
文字上自动工作,但我不确定是什么。 {-# LANGUAGE OverloadedStrings #-}
似乎没有任何区别。