compare package:base

Compare branches on the kind of its arguments to either compare by Symbol or Nat.
Use compareLength xs n as a safer and faster alternative to compare (length xs) n. Similarly, it's better to write compareLength xs 10 == LT instead of length xs < 10. While length would force and traverse the entire spine of xs (which could even diverge if xs is infinite), compareLength traverses at most n elements to determine its result.
>>> compareLength [] 0
EQ

>>> compareLength [] 1
LT

>>> compareLength ['a'] 1
EQ

>>> compareLength ['a', 'b'] 1
GT

>>> compareLength [0..] 100
GT

>>> compareLength undefined (-1)
GT

>>> compareLength ('a' : undefined) 0
GT
Lift the standard compare function through the type constructor.
Lift the standard compare function through the type constructor.
Use compareLength xs n as a safer and faster alternative to compare (length xs) n. Similarly, it's better to write compareLength xs 10 == LT instead of length xs < 10. While length would force and traverse the entire spine of xs (which could even diverge if xs is infinite), compareLength traverses at most n elements to determine its result.
>>> compareLength ('a' :| []) 1
EQ

>>> compareLength ('a' :| ['b']) 3
LT

>>> compareLength (0 :| [1..]) 100
GT

>>> compareLength undefined 0
GT

>>> compareLength ('a' :| 'b' : undefined) 1
GT
compareByteArrays# src1 src1_ofs src2 src2_ofs n compares n bytes starting at offset src1_ofs in the first ByteArray# src1 to the range of n bytes (i.e. same length) starting at offset src2_ofs of the second ByteArray# src2. Both arrays must fully contain the specified ranges, but this is not checked. Returns an Int# less than, equal to, or greater than zero if the range is found, respectively, to be byte-wise lexicographically less than, to match, or be greater than the second range.
Used to implement compare for the Integral typeclass. This takes two integers, and outputs whether the first is less than, equal to, or greater than the second.

Example

>>> compareInteger 2 10
LT
>>> compare 2 10
LT
Lift a compare function through the type constructor. The function will usually be applied to a comparison function, but the more general type ensures that the implementation uses it to compare elements of the first container with elements of the second.
Lift compare functions through the type constructor. The function will usually be applied to comparison functions, but the more general type ensures that the implementation uses them to compare elements of the first container with elements of the second.