[Haskell-beginners] Reading binary data into numeric types

Brandon Allbery allbery.b at gmail.com
Sun Jun 21 01:32:43 UTC 2015


On Sat, Jun 20, 2015 at 9:29 PM, Barry DeZonia <bdezonia at gmail.com> wrote:

> I need to write some code that will read binary data from a file into
> various types defined in Data.Int, Data.Word, and the floating types. I am
> looking to make functions with signatures like Handle->IO Word16 and
> Handle->IO Int32 and Handle->IO Float and others similarly defined. One
> complication I am running into is that the data is stored in big endian
> byte
>

Hopefully you don't have some requirement to reinvent this wheel; the
binary package already provides it, including support for endianness.

http://hackage.haskell.org/package/binary

-- 
brandon s allbery kf8nh                               sine nomine associates
allbery.b at gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20150620/a3d85f24/attachment.html>


More information about the Beginners mailing list