ord -package:sbv package:incipit-base

The fromEnum method restricted to the type Char.
The Ord class is used for totally ordered datatypes. Instances of Ord can be derived for any user-defined datatype whose constituent types are in Ord. The declared order of the constructors in the data declaration determines the ordering in derived Ord instances. The Ordering datatype allows a single comparison to determine the precise ordering of two objects. Ord, as defined by the Haskell report, implements a total order and has the following properties:
  • Comparability x <= y || y <= x = True
  • Transitivity if x <= y && y <= z = True, then x <= z = True
  • Reflexivity x <= x = True
  • Antisymmetry if x <= y && y <= x = True, then x == y = True
The following operator interactions are expected to hold:
  1. x >= y = y <= x
  2. x < y = x <= y && x /= y
  3. x > y = y < x
  4. x < y = compare x y == LT
  5. x > y = compare x y == GT
  6. x == y = compare x y == EQ
  7. min x y == if x <= y then x else y = True
  8. max x y == if x >= y then x else y = True
Note that (7.) and (8.) do not require min and max to return either of their arguments. The result is merely required to equal one of the arguments in terms of (==). Minimal complete definition: either compare or <=. Using compare can be more efficient for complex types.
Ordering data type for type literals that provides proof of their ordering.
A Word is an unsigned integral type, with the same size as Int.
16-bit unsigned integer type
32-bit unsigned integer type
64-bit unsigned integer type
8-bit unsigned integer type
unwords takes list of Text values and joins them with space character. Actual type of this function is the following:
unwords :: [Text] -> Text
but it was given a more complex type to provide friendlier compile time errors.
>>> unwords []
""

>>> unwords ["singleWord"]
"singleWord"

>>> unwords ["word", "another"]
"word another"

>>> unwords (["word", "another"] :: [String])
...
... 'unwords' works with 'Text', not 'String'.
Possible fixes:
1. Make sure OverloadedStrings extension is enabled.
2. Apply 'toText' to a single value.
3. Apply 'map toText' to the list value.
...

>>> unwords [True, False]
...
... 'unwords' works with 'Text'
But given: 'Bool'
...
words takes Text and splits it into the list by words. Actual type of this function is the following:
words :: Text -> [Text]
but it was given a more complex type to provide friendlier compile time errors.
>>> words ""
[]

>>> words "one line"
["one","line"]

>>> words "   >_<   "
[">_<"]

>>> words ("string words" :: String)
...
... 'words' works with 'Text', not 'String'.
Possible fixes:
1. Make sure OverloadedStrings extension is enabled.
2. Apply 'toText' to a single value.
3. Apply 'map toText' to the list value.
...

>>> words True
...
... 'words' works with 'Text'
But given: 'Bool'
...