ByteString has an instance of Monoid, so it can be combined in the usual way of combining monoids using (Data.Monoid.<>) .
The same statement also works for strings, because String ~ [Char] and [a] has an instance of Monoid, where (<>) = (++) .
Prelude Data.Monoid Data.ByteString.Char8> unpack $ pack "abc" <> pack "def" "abcdef"
Here I convert two strings to ByteStrings, combine them like ByteStrings, and then convert back to String to demonstrate that it worked.
amalloy
source share