[Haskell-beginners] show vs. Data.ByteString.Char8.unpack for ByteString

Daniel Fischer daniel.is.fischer at web.de
Thu Feb 4 16:05:18 EST 2010


Am Donnerstag 04 Februar 2010 21:46:39 schrieb Hong Yang:
> Hi,
>
> What is the difference between show and unpack when the function
> arguments are of ByteString type? I thought they are the same, but they
> are not interchangeable at compile time.
>
> Thanks,
>
> Hong

If you're using Data.ByteString, unpack has type

ByteString -> [Word8]

unpack and show are the same (perhaps excepting efficiency) if you use 
Data.ByteString.Char8
(ditto for Data.ByteString.Lazy[.Char8]).


More information about the Beginners mailing list