<div dir="ltr">I agree with every one of Ian&#39;s points here. <div><br></div><div>Just bolting the functions in non-overloaded in Data.Word would be a useful starting point and side-steps concerns of what it means when you have (Finite)Bits instances that don&#39;t evenly divide into bytes, etc.</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, May 17, 2013 at 2:37 PM, Ian Lynagh <span dir="ltr">&lt;<a href="mailto:ian@well-typed.com" target="_blank">ian@well-typed.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Thu, May 16, 2013 at 11:36:46AM +0200, Vincent Hanquez wrote:<br>
&gt; On Thu, May 16, 2013 at 05:07:51AM -0400, Edward Kmett wrote:<br>
&gt; &gt; Henning has a point.<br>
&gt; &gt;<br>
&gt; &gt; EndianSensitive is arguably the more appropriate notion.<br>
&gt;<br>
&gt; Yes, Bits is not necessarily the best fit in term of naming or feature, but<br>
&gt; nothing close to EndianSensitive is in base.<br>
<br>
</div>There&#39;s no reason that the recommended interface to the primitives needs<br>
to be in base. It would be a little unfriendly to only export the<br>
primitives, but we could just export<br>
    byteSwap16 :: Word16 -&gt; Word16<br>
    byteSwap32 :: Word32 -&gt; Word32<br>
    byteSwap64 :: Word64 -&gt; Word64<br>
and leave it up to packages like data-endian to provide a more<br>
user-friendly interface.<br>
<br>
The problem with adding a Bytes class is there are various questions,<br>
like &quot;should there be an instance Bytes a =&gt; Bytes [a]?&quot;, &quot;should there<br>
be a toWord8s :: a -&gt; [Word8]&quot; method?&quot;, and &quot;would Word8s be a better<br>
name for the class?&quot;. If the class goes into base, then it&#39;s a lot<br>
harder to change the answers to these questions (and, indeed, to the<br>
questions that we don&#39;t think to ask before the class is in a released<br>
GHC).<br>
<br>
I think that adding the functions above, probably to Data.Word, would be<br>
my preference.<br>
<br>
<br>
Oh, and for the record, I also prefer &quot;byteSwap&quot; to &quot;bswap&quot;, and dislike<br>
using (Finite)Bits for this.<br>
<br>
<br>
Thanks<br>
<span class="HOEnZb"><font color="#888888">Ian<br>
<br>
</font></span></blockquote></div><br></div>