Search code examples
haskellbytestring

Haskell: Does ghci show "Chunk .. Empty"?


Learn You a Haskell has a code example like this:

ghci> B.pack [99,97,110]  
Chunk "can" Empty  

(B stands for Data.ByteString.Lazy)

But my ghci does not show Chunk and Empty data constructors.

> B.pack [99,97,110]  
"can"

Did Haskell developers change the way the values of ByteString are printed?


Solution

  • Looks like Duncan added hand-written Show instance for lazy ByteString somewhere between 0.9.2.1 and 0.10.0.1. See http://hackage.haskell.org/packages/archive/bytestring/0.10.2.0/doc/html/src/Data-ByteString-Lazy-Internal.html#ByteString

    Add: Here is the relevant patch