Proposal: Export Data.Word.Word from Prelude
Malcolm Wallace
malcolm.wallace at me.com
Sun Aug 10 08:07:42 UTC 2014
On 10 Aug 2014, at 07:04, Ivan Lazar Miljenovic wrote:
> I'm +1 on the re-exporting (I would be tempted to go the whole hog and
> re-export all the Word* types as well).
I was involved in the discussions when the Word type was originally added to Haskell, primarily for the use of the FFI. As I recall, people were deeply uncomfortable that there should even be a Word type, with unspecified precision. The types Word8, Word16, Word32, and Word64 were entirely uncontroversial, because you know what you are dealing with. The primary use of the Word* types was to represent machine words (bytes, half-words, etc), enabling (for instance) bit-twiddling of individual components of the word. With an unknown-precision Word value, you can guarantee nothing about whether your bit-operation will work. I believe the use of unknown-precision Word to represent non-negative integers was the winning justification, but it remains controversial in the same way that Int (rather than Int32, or Integer) does. Lack of clarity over whether or when a number overflows is a pretty bad downside. Pragmatically, it may work OK for most people most of the time. But the Haskell way is to prefer correctness.
Regards,
Malcolm
More information about the Libraries
mailing list