TextByteString

由于 String 仅仅只是 [Char] 的别名,所以速度很慢.以下两种类型可以用于替代 String

  • Data.Text 表示 a sequence of Unicode Chars
  • Data.ByteString 表示 a sequence of Bytes,通常用于处理二进制数据

也有 strict 和 lazy 之分:

The strict Text type requires that an entire string fit into memory at once. The lazy Text type is capable of streaming strings that are larger than memory using a small memory footprint… Each module provides an almost identical API…

这两个类型都有 pack, unpack 方法完成与 String 之间的互相转化

即使载入同一个字符串,Text.Lazy 有时和 Text 也会不相等,需要用 fromStrict, toStrict 进行转化.

HTTP: WAIWarp