Binary IO

Iavor Diatchki iavor.diatchki at gmail.com
Wed Apr 20 15:56:27 EDT 2005


Hello,
I've been playing around with decoding binary files, and I couldn't
find a function in the libraries to read a byte from a file. Does
anyone know if there is such a function?  If not, I think we should
add one.  Currently I am using hGetChar for this purpose but it seems
that we should have:
hGetByte :: Handle -> IO Word8

I don't think that hGetChar is good enough because characters are not
bytes.  In particular it seems that an implementation could consult
the system's locale settings and use a variable character encoding
such as UTF8.

Also on a related note, is there a way to work with memory mapped
files in Haskell/GHC?

-Iavor


More information about the Libraries mailing list