Is there an append operator for ByteString?

concat :: [ByteString] -> ByteString

O(n) Concatenate a list of ByteStrings.


ByteString has a Semigroup instance, so it can be combined in the usual way that semigroups are combined, with (<>).

The same operator works for strings as well, because String ~ [Char], and [a] has a Semigroup instance where (<>) = (++).

Prelude Data.ByteString.Char8> unpack $ pack "abc" <> pack "def"
"abcdef"

Here I convert two Strings to ByteStrings, combine them as ByteStrings, and then convert back to String to demonstrate that it's worked.