[Haskell-beginners] parsing exif file: binary, binary-strict, or cereal?
Emmanuel Touzery
etouzery at gmail.com
Sun Apr 13 08:21:12 UTC 2014
Hello,
I could not find a pure haskell library to parse EXIF so I wrote one
(pretty basic so far):
https://github.com/emmanueltouzery/hsexif
I wrote it with binary-strict. I also considered binary, but I would like
the library not to throw an exception if the file that it's given is not a
JPEG or is a JPEG without EXIF, but rather return an Either. I didn't
manage to do that with binary (I mean I could offer an IO monad wrapper
with try* but to do that even if you give me a lazy bytestring, when it
could be done only with pure code, is annoying).
It annoys me to load the full JPEG in memory just to parse its EXIF
though. Then again with binary I'd have to be pretty careful with
strictness annotations and so on, although parsing the EXIF is going to be
fast and it won't contain that much data. Still, I want the lazy bytestring
holding the JPEG file to be released ASAP. It'd be a shame to have it lying
in memory, together with holding the JPEG file open until the library
caller actually makes use of the EXIF contents...
And then I realized that binary-strict was last updated in 2010, it seems
cereal is recommended for strict binary file parsing nowadays.
So, what should I do? Leave it as it is? Port to cereal? Port to binary?
Otherwise I did write this because I'd like to make a program to parse
EXIF file which will have to run also on windows. The haskell exif parsing
library that I could find uses the C library libexif, which is going to get
complicated to get running on windows. Plus it was fun :-)
Thanks,
Emmanuel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20140413/5dae8eac/attachment.html>
More information about the Beginners
mailing list