Why is an unsigned integral type in Haskell called "Word"? Does the "ord" stand for "ordinal"?
Here is the documentation on Data.Word: http://hackage.haskell.org/package/base-4.6.0.1/docs/Data-Word.html#t:Word
This is a very hard question to google!
Overview. The words function in Haskell is a built-in function that takes a String and separates it by whitespace characters.
() is very often used as the result of something that has no interesting result. For example, an IO action that is supposed to perform some I/O and terminate without producing a result will typically have type IO () .
From wikipedia:
The term 'word' is used for a small group of bits which are handled simultaneously by processors of a particular architecture. The size of a word is thus CPU-specific. Many different word sizes have been used, including 6-, 8-, 12-, 16-, 18-, 24-, 32-, 36-, 39-, 48-, 60-, and 64-bit. Since it is architectural, the size of a word is usually set by the first CPU in a family, rather than the characteristics of a later compatible CPU. The meanings of terms derived from word, such as longword, doubleword, quadword, and halfword, also vary with the CPU and OS.
In short, a word is a fixed-length group of bits that the CPU can process. We normally work with words that are powers of two, since modern CPUs handle those very well. A word
in particular is not really a number, although we treat it as such for most purposes. Instead, just think of it as a fixed number of bits in RAM that you can manipulate. A common use for something like Word8
is to implement ASCII C-style strings, for example. Haskell's implementation treats WordN
types as unsigned integers that implement Num
, among other type classes.
There is a module called Data.Ord
where "Ord" stands for "Ordering". It has extra functions for working with comparisons of datatypes and is where the Ordering
datatype and Ord
typeclass are defined. It is unrelated to Data.Word
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With