
get (0::Word8) getWord8be 0
Make that
put (0 :: Word16) putWord16be 0
?
Yes, thanks for the correction. Word8 was a bad choice since endianness is
not an issue.
Thanks for all the advice. It seems I should avoid making my types instances
of Binary. In fact, this relates to another design issue I've been grappling
with, supporting multiple versions of the protocol. Probably I'll need
something like, putProtVersion1, putProtVersion2, etc. Or something along
this line.
On Tue, May 11, 2010 at 3:41 PM, Daniel Fischer
On Tuesday 11 May 2010 21:01:19, Stephen Tetley wrote:
On 11 May 2010 19:16, Daniel Fischer
wrote: Int8 and Word8 are unproblematic (unless you have a ones-complement machine), the problems appear only for larger types, [SNIP]
Hi Daniel
Likely I was revealing a personal bias on that one, the only protocol I've implemented where Int8 has featured has been MIDI.
If MIDI isn't ones-complement, my codes - I've written decoders / encoders several times - have been wrong for years...
I've no idea how MIDI messages/files/streams are interpreted, I was thinking about the hardware, how the ALU interprets the bit-pattern for arithmetic.
Best wishes
Stephen
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners