<div dir="ltr"><div>This is easy in Haskell too and binary provide everything you need. It's not like you're _forced_ to use the Vector instance to construct a Vector from your values, you can simply repeat (with replicateM) the get for the Float (or Double) instance instead and build a Vector from the resulting list (if you do it properly it will probably fuse into a tight loop anyway).<br><br></div>I don't understand your problem ?<br><div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 29, 2014 at 5:52 PM, David Raymond <span dir="ltr"><<a href="mailto:raymond@kestrel.nmt.edu" target="_blank">raymond@kestrel.nmt.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
I am trying to read and write to/from files or stdout/stdin that have<br>
an ascii header followed by unformatted float32 binary data.  (The<br>
files are created using a C program.)  The ascii header first needs to<br>
be parsed to understand the structure of the floating point data.  I<br>
have solved the parsing problem, but getting the unformatted binary<br>
float data into a series of float (or double) immutable, unboxed<br>
vectors has defeated me so far.  The binary package doesn't help as<br>
far as I can see, as the binary format it reads and writes has some<br>
control information at the beginning that doesn't exist in the format<br>
I am reading.<br>
<br>
This is easy in C, but seems to be hard in Haskell unless I am missing<br>
something.<br>
<br>
Any suggestions?<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
David J. Raymond<br>
Prof. of Physics<br>
New Mexico Tech<br>
<a href="http://www.physics.nmt.edu/~raymond/index.html" target="_blank">http://www.physics.nmt.edu/~raymond/index.html</a><br>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a><br>
</font></span></blockquote></div><br></div></div></div>