<div>Here are the methods in question:</div><div><pre><span class="hs-comment" style="color:green">-- | Conversion between &#39;Word8&#39; and &#39;Char&#39;. Should compile to a no-op.</span>
<a name="line-284"></a><span class="hs-definition">w2c</span> <span class="hs-keyglyph" style="color:red">::</span> <span class="hs-conid">Word8</span> <span class="hs-keyglyph" style="color:red">-&gt;</span> <span class="hs-conid">Char</span>
<a name="line-285"></a><span class="hs-cpp">#if !defined(__GLASGOW_HASKELL__)</span>
<a name="line-286"></a><span class="hs-definition">w2c</span> <span class="hs-keyglyph" style="color:red">=</span> <span class="hs-varid">chr</span> <span class="hs-varop">.</span> <span class="hs-varid">fromIntegral</span>
<a name="line-287"></a><span class="hs-cpp">#else</span>
<a name="line-288"></a><span class="hs-definition">w2c</span> <span class="hs-keyglyph" style="color:red">=</span> <span class="hs-varid">unsafeChr</span> <span class="hs-varop">.</span> <span class="hs-varid">fromIntegral</span>
<a name="line-289"></a><span class="hs-cpp">#endif</span>
<a name="line-290"></a><span class="hs-comment" style="color:green">{-# INLINE w2c #-}</span>
<a name="line-291"></a>
<a name="line-292"></a><a name="c2w"></a><span class="hs-comment" style="color:green">-- | Unsafe conversion between &#39;Char&#39; and &#39;Word8&#39;. This is a no-op and</span>
<a name="line-293"></a><span class="hs-comment" style="color:green">-- silently truncates to 8 bits Chars &gt; &#39;\255&#39;. It is provided as</span>
<a name="line-294"></a><span class="hs-comment" style="color:green">-- convenience for ByteString construction.</span>
<a name="line-295"></a><span class="hs-definition">c2w</span> <span class="hs-keyglyph" style="color:red">::</span> <span class="hs-conid">Char</span> <span class="hs-keyglyph" style="color:red">-&gt;</span> <span class="hs-conid">Word8</span>
<a name="line-296"></a><span class="hs-definition">c2w</span> <span class="hs-keyglyph" style="color:red">=</span> <span class="hs-varid">fromIntegral</span> <span class="hs-varop">.</span> <span class="hs-varid">ord</span>
<a name="line-297"></a><span class="hs-comment" style="color:green">{-# INLINE c2w #-}</span></pre></div><div>They should both be harmless, according to the docs. </div><br><br><div class="gmail_quote">2012/9/20 Johan Tibell <span dir="ltr">&lt;<a href="mailto:johan.tibell@gmail.com" target="_blank">johan.tibell@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Thu, Sep 20, 2012 at 10:41 AM, Kazu Yamamoto &lt;<a href="mailto:kazu@iij.ad.jp">kazu@iij.ad.jp</a>&gt; wrote:<br>

&gt; Why do people use Data.ByteString.Char8? I guess that there are two<br>
&gt; reasons:<br>
&gt;<br>
&gt; - There are no standard utility functions for Word8 such as &quot;isUpper&quot;<br>
&gt; - Numeric literal (e.g 72 for &#39;H&#39;) is not readable<br>
<br>
</div>The Char8 module was added so that it&#39;s easier to work with protocols<br>
that mix binary and ASCII data, such as HTTP.<br>
<br>
Note that Word8 is represented using a full machine word, just like<br>
Char, so you&#39;re unlikely to get any performance improvements from<br>
Word8 in this case (unless GHC fails to simplify e.g. calls to &#39;ord&#39;<br>
and &#39;chr&#39; in places).<br>
<span class="HOEnZb"><font color="#888888"><br>
-- Johan<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
web-devel mailing list<br>
<a href="mailto:web-devel@haskell.org">web-devel@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/web-devel" target="_blank">http://www.haskell.org/mailman/listinfo/web-devel</a><br>
</div></div></blockquote></div><br>