Skip to content

Byteswap should imply narrowing

The implementation of GHC.Word.byteSwap16 is:

byteSwap16 :: Word16 -> Word16
byteSwap16 (W16# w#) = W16# (narrow16Word# (byteSwap16# w#))

In #12095 (closed), @trac-thoughtpolice argues that the narrowing should be implied by the byteswap primitives, that the implementation of the function above should actually be:

byteSwap16 :: Word16 -> Word16
byteSwap16 (W16# w#) = W16# (byteSwap16# w#)

I also think this change makes sense.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information