comp package:base

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
Reverse all the bits in the argument
x `complementBit` i is the same as x `xor` bit i
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
comparing p x y = compare (p x) (p y)
Useful combinator for use in conjunction with the xxxBy family of functions from Data.List, for example:
... sortBy (comparing fst) ...
The Haskell implementation with which the program was compiled or is being interpreted. On the GHC platform, the value is "ghc".
The version of compilerName with which the program was compiled or is being interpreted.

Example

ghci> compilerVersion
Version {versionBranch = [8,8], versionTags = []}
Recursively add a closure and its transitive closure to a Compact# (a CNF), evaluating any unevaluated components at the same time. Note: compactAdd# is not thread-safe, so only one thread may call compactAdd# with a particular Compact# at any given time. The primop does not enforce any mutual exclusion; the caller is expected to arrange this.
Like compactAdd#, but retains sharing and cycles during compaction.
Attempt to allocate a compact block with the capacity (in bytes) given by the first argument. The Addr# is a pointer to previous compact block of the CNF or nullAddr# to create a new CNF with a single compact block. The resulting block is not known to the GC until compactFixupPointers# is called on it, and care must be taken so that the address does not escape or memory will be leaked.
Returns 1# if the object is contained in the CNF, 0# otherwise.
Returns 1# if the object is in any CNF at all, 0# otherwise.
Given the pointer to the first block of a CNF and the address of the root object in the old address space, fix up the internal pointers inside the CNF to account for a different position in memory than when it was serialized. This method must be called exactly once after importing a serialized CNF. It returns the new CNF and the new adjusted root address.
Returns the address and the utilized size (in bytes) of the first compact block of a CNF.
Given a CNF and the address of one its compact blocks, returns the next compact block and its utilized size, or nullAddr# if the argument was the last compact block in the CNF.
Create a new CNF with a single compact block. The argument is the capacity of the compact block (in bytes, not words). The capacity is rounded up to a multiple of the allocator block size and is capped to one mega block.
Set the new allocation size of the CNF. This value (in bytes) determines the capacity of each compact block in the CNF. It does not retroactively affect existing compact blocks in the CNF.
Return the total capacity (in bytes) of all the compact blocks in the CNF.
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.