System.Posix.IO.ByteString types?

Ben Gamari bgamari.foss at
Thu Jul 5 10:57:45 CEST 2012

Recently, I spent a fair amount of time tracking down an encoding issue[1]
in the `serialport` package. As is often the case, `serialport` used
Strings, which blew up quite nicely when working with a binary
protocol. Delving into the code it eventually became fairly obvious that
the problem was due to encoding and could be fixed by completely moving
to ByteStrings.

Unfortunately, while the unix package contains a
System.Posix.IO.ByteString module, all of the functions within still
appear to work with Strings[2]. While it appears that paths are handled
a bit differently in the ByteString variant, but it seems like this is a
fairly small consideration compared to the data itself.

Have I stumbled across a bug? Is there anyway short of the non-Haskell
Platform unix-bytestring package to get ByteStrings out of fds? If not,
it seems this is a large hole in the interfaces exposed by unix. Is
there any plan to remedy this?


- Ben


More information about the Libraries mailing list