ghc-prim-0.6.1: GHC primitives

GHC.Classes

Description

Basic classes.

Synopsis

Implicit paramaters

class IP (x :: Symbol) a | x -> a where Source #

The syntax ?x :: a is desugared into IP "x" a IP is declared very early, so that libraries can take advantage of the implicit-call-stack feature

Methods

ip :: a Source #

Equality and ordering

class Eq a where Source #

The Eq class defines equality (==) and inequality (/=). All the basic datatypes exported by the Prelude are instances of Eq, and Eq may be derived for any datatype whose constituents are also instances of Eq.

The Haskell Report defines no laws for Eq. However, == is customarily expected to implement an equivalence relationship where two values comparing equal are indistinguishable by "public" functions, with a "public" function being one not allowing to see implementation details. For example, for a type representing non-normalised natural numbers modulo 100, a "public" function doesn't make the difference between 1 and 201. It is expected to have the following properties:

Reflexivity
x == x = True
Symmetry
x == y = y == x
Transitivity
if x == y && y == z = True, then x == z = True
Substitutivity
if x == y = True and f is a "public" function whose return type is an instance of Eq, then f x == f y = True
Negation
x /= y = not (x == y)

Minimal complete definition: either == or /=.

Minimal complete definition

Methods

(==) :: a -> a -> Bool infix 4 Source #

(/=) :: a -> a -> Bool infix 4 Source #

Instances

Instances details
 # Instance detailsDefined in GHC.Classes Methods(==) :: Bool -> Bool -> Bool Source #(/=) :: Bool -> Bool -> Bool Source # # Instance detailsDefined in GHC.Classes Methods(==) :: Char -> Char -> Bool Source #(/=) :: Char -> Char -> Bool Source # # Note that due to the presence of NaN, Double's Eq instance does not satisfy reflexivity.>>> 0/0 == (0/0 :: Double) False Also note that Double's Eq instance does not satisfy substitutivity:>>> 0 == (-0 :: Double) True >>> recip 0 == recip (-0 :: Double) False  Instance detailsDefined in GHC.Classes Methods # Note that due to the presence of NaN, Float's Eq instance does not satisfy reflexivity.>>> 0/0 == (0/0 :: Float) False Also note that Float's Eq instance does not satisfy substitutivity:>>> 0 == (-0 :: Float) True >>> recip 0 == recip (-0 :: Float) False  Instance detailsDefined in GHC.Classes Methods # Instance detailsDefined in GHC.Classes Methods(==) :: Int -> Int -> Bool Source #(/=) :: Int -> Int -> Bool Source # # Instance detailsDefined in GHC.Classes Methods # Instance detailsDefined in GHC.Classes Methods(==) :: Word -> Word -> Bool Source #(/=) :: Word -> Word -> Bool Source # Eq () # Instance detailsDefined in GHC.Classes Methods(==) :: () -> () -> Bool Source #(/=) :: () -> () -> Bool Source # # Instance detailsDefined in GHC.Classes Methods # Instance detailsDefined in GHC.Classes Methods # Instance detailsDefined in GHC.Classes Methods (Eq a, Eq b) => Eq (a, b) # Instance detailsDefined in GHC.Classes Methods(==) :: (a, b) -> (a, b) -> Bool Source #(/=) :: (a, b) -> (a, b) -> Bool Source # (Eq a, Eq b, Eq c) => Eq (a, b, c) # Instance detailsDefined in GHC.Classes Methods(==) :: (a, b, c) -> (a, b, c) -> Bool Source #(/=) :: (a, b, c) -> (a, b, c) -> Bool Source # (Eq a, Eq b, Eq c, Eq d) => Eq (a, b, c, d) # Instance detailsDefined in GHC.Classes Methods(==) :: (a, b, c, d) -> (a, b, c, d) -> Bool Source #(/=) :: (a, b, c, d) -> (a, b, c, d) -> Bool Source # (Eq a, Eq b, Eq c, Eq d, Eq e) => Eq (a, b, c, d, e) # Instance detailsDefined in GHC.Classes Methods(==) :: (a, b, c, d, e) -> (a, b, c, d, e) -> Bool Source #(/=) :: (a, b, c, d, e) -> (a, b, c, d, e) -> Bool Source # (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f) => Eq (a, b, c, d, e, f) # Instance detailsDefined in GHC.Classes Methods(==) :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> Bool Source #(/=) :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> Bool Source # (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g) => Eq (a, b, c, d, e, f, g) # Instance detailsDefined in GHC.Classes Methods(==) :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> Bool Source #(/=) :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> Bool Source # (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h) => Eq (a, b, c, d, e, f, g, h) # Instance detailsDefined in GHC.Classes Methods(==) :: (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) -> Bool Source #(/=) :: (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) -> Bool Source # (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i) => Eq (a, b, c, d, e, f, g, h, i) # Instance detailsDefined in GHC.Classes Methods(==) :: (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) -> Bool Source #(/=) :: (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) -> Bool Source # (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j) => Eq (a, b, c, d, e, f, g, h, i, j) # Instance detailsDefined in GHC.Classes Methods(==) :: (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) -> Bool Source #(/=) :: (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) -> Bool Source # (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k) => Eq (a, b, c, d, e, f, g, h, i, j, k) # Instance detailsDefined in GHC.Classes Methods(==) :: (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) -> Bool Source #(/=) :: (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) -> Bool Source # (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l) => Eq (a, b, c, d, e, f, g, h, i, j, k, l) # Instance detailsDefined in GHC.Classes Methods(==) :: (a, b, c, d, e, f, g, h, i, j, k, l) -> (a, b, c, d, e, f, g, h, i, j, k, l) -> Bool Source #(/=) :: (a, b, c, d, e, f, g, h, i, j, k, l) -> (a, b, c, d, e, f, g, h, i, j, k, l) -> Bool Source # (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l, Eq m) => Eq (a, b, c, d, e, f, g, h, i, j, k, l, m) # Instance detailsDefined in GHC.Classes Methods(==) :: (a, b, c, d, e, f, g, h, i, j, k, l, m) -> (a, b, c, d, e, f, g, h, i, j, k, l, m) -> Bool Source #(/=) :: (a, b, c, d, e, f, g, h, i, j, k, l, m) -> (a, b, c, d, e, f, g, h, i, j, k, l, m) -> Bool Source # (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l, Eq m, Eq n) => Eq (a, b, c, d, e, f, g, h, i, j, k, l, m, n) # Instance detailsDefined in GHC.Classes Methods(==) :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> Bool Source #(/=) :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> Bool Source # (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l, Eq m, Eq n, Eq o) => Eq (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) # Instance detailsDefined in GHC.Classes Methods(==) :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> Bool Source #(/=) :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> Bool Source #

class Eq a => Ord a where Source #

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.

The Haskell Report defines no laws for Ord. However, <= is customarily expected to implement a non-strict partial order and have the following properties:

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

Note that 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.

Minimal complete definition

Methods

compare :: a -> a -> Ordering Source #

(<) :: a -> a -> Bool infix 4 Source #

(<=) :: a -> a -> Bool infix 4 Source #

(>) :: a -> a -> Bool infix 4 Source #

(>=) :: a -> a -> Bool infix 4 Source #

max :: a -> a -> a Source #

min :: a -> a -> a Source #

Instances

Instances details
 # Instance detailsDefined in GHC.Classes Methods(<) :: Bool -> Bool -> Bool Source #(<=) :: Bool -> Bool -> Bool Source #(>) :: Bool -> Bool -> Bool Source #(>=) :: Bool -> Bool -> Bool Source #max :: Bool -> Bool -> Bool Source #min :: Bool -> Bool -> Bool Source # # Instance detailsDefined in GHC.Classes Methods(<) :: Char -> Char -> Bool Source #(<=) :: Char -> Char -> Bool Source #(>) :: Char -> Char -> Bool Source #(>=) :: Char -> Char -> Bool Source #max :: Char -> Char -> Char Source #min :: Char -> Char -> Char Source # # Note that due to the presence of NaN, Double's Ord instance does not satisfy reflexivity.>>> 0/0 <= (0/0 :: Double) False Also note that, due to the same, Ord's operator interactions are not respected by Double's instance:>>> (0/0 :: Double) > 1 False >>> compare (0/0 :: Double) 1 GT  Instance detailsDefined in GHC.Classes Methods # Note that due to the presence of NaN, Float's Ord instance does not satisfy reflexivity.>>> 0/0 <= (0/0 :: Float) False Also note that, due to the same, Ord's operator interactions are not respected by Float's instance:>>> (0/0 :: Float) > 1 False >>> compare (0/0 :: Float) 1 GT  Instance detailsDefined in GHC.Classes Methods(<) :: Float -> Float -> Bool Source #(>) :: Float -> Float -> Bool Source # # Instance detailsDefined in GHC.Classes Methods(<) :: Int -> Int -> Bool Source #(<=) :: Int -> Int -> Bool Source #(>) :: Int -> Int -> Bool Source #(>=) :: Int -> Int -> Bool Source #max :: Int -> Int -> Int Source #min :: Int -> Int -> Int Source # # Instance detailsDefined in GHC.Classes Methods # Instance detailsDefined in GHC.Classes Methods(<) :: Word -> Word -> Bool Source #(<=) :: Word -> Word -> Bool Source #(>) :: Word -> Word -> Bool Source #(>=) :: Word -> Word -> Bool Source #max :: Word -> Word -> Word Source #min :: Word -> Word -> Word Source # Ord () # Instance detailsDefined in GHC.Classes Methodscompare :: () -> () -> Ordering Source #(<) :: () -> () -> Bool Source #(<=) :: () -> () -> Bool Source #(>) :: () -> () -> Bool Source #(>=) :: () -> () -> Bool Source #max :: () -> () -> () Source #min :: () -> () -> () Source # # Instance detailsDefined in GHC.Classes Methods(<) :: TyCon -> TyCon -> Bool Source #(>) :: TyCon -> TyCon -> Bool Source # (Ord a, Ord b) => Ord (a, b) # Instance detailsDefined in GHC.Classes Methodscompare :: (a, b) -> (a, b) -> Ordering Source #(<) :: (a, b) -> (a, b) -> Bool Source #(<=) :: (a, b) -> (a, b) -> Bool Source #(>) :: (a, b) -> (a, b) -> Bool Source #(>=) :: (a, b) -> (a, b) -> Bool Source #max :: (a, b) -> (a, b) -> (a, b) Source #min :: (a, b) -> (a, b) -> (a, b) Source # (Ord a, Ord b, Ord c) => Ord (a, b, c) # Instance detailsDefined in GHC.Classes Methodscompare :: (a, b, c) -> (a, b, c) -> Ordering Source #(<) :: (a, b, c) -> (a, b, c) -> Bool Source #(<=) :: (a, b, c) -> (a, b, c) -> Bool Source #(>) :: (a, b, c) -> (a, b, c) -> Bool Source #(>=) :: (a, b, c) -> (a, b, c) -> Bool Source #max :: (a, b, c) -> (a, b, c) -> (a, b, c) Source #min :: (a, b, c) -> (a, b, c) -> (a, b, c) Source # (Ord a, Ord b, Ord c, Ord d) => Ord (a, b, c, d) # Instance detailsDefined in GHC.Classes Methodscompare :: (a, b, c, d) -> (a, b, c, d) -> Ordering Source #(<) :: (a, b, c, d) -> (a, b, c, d) -> Bool Source #(<=) :: (a, b, c, d) -> (a, b, c, d) -> Bool Source #(>) :: (a, b, c, d) -> (a, b, c, d) -> Bool Source #(>=) :: (a, b, c, d) -> (a, b, c, d) -> Bool Source #max :: (a, b, c, d) -> (a, b, c, d) -> (a, b, c, d) Source #min :: (a, b, c, d) -> (a, b, c, d) -> (a, b, c, d) Source # (Ord a, Ord b, Ord c, Ord d, Ord e) => Ord (a, b, c, d, e) # Instance detailsDefined in GHC.Classes Methodscompare :: (a, b, c, d, e) -> (a, b, c, d, e) -> Ordering Source #(<) :: (a, b, c, d, e) -> (a, b, c, d, e) -> Bool Source #(<=) :: (a, b, c, d, e) -> (a, b, c, d, e) -> Bool Source #(>) :: (a, b, c, d, e) -> (a, b, c, d, e) -> Bool Source #(>=) :: (a, b, c, d, e) -> (a, b, c, d, e) -> Bool Source #max :: (a, b, c, d, e) -> (a, b, c, d, e) -> (a, b, c, d, e) Source #min :: (a, b, c, d, e) -> (a, b, c, d, e) -> (a, b, c, d, e) Source # (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f) => Ord (a, b, c, d, e, f) # Instance detailsDefined in GHC.Classes Methodscompare :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> Ordering Source #(<) :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> Bool Source #(<=) :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> Bool Source #(>) :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> Bool Source #(>=) :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> Bool Source #max :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> (a, b, c, d, e, f) Source #min :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> (a, b, c, d, e, f) Source # (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g) => Ord (a, b, c, d, e, f, g) # Instance detailsDefined in GHC.Classes Methodscompare :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> Ordering Source #(<) :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> Bool Source #(<=) :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> Bool Source #(>) :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> Bool Source #(>=) :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> Bool Source #max :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) Source #min :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) Source # (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h) => Ord (a, b, c, d, e, f, g, h) # Instance detailsDefined in GHC.Classes Methodscompare :: (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) -> Ordering Source #(<) :: (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) -> Bool Source #(<=) :: (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) -> Bool Source #(>) :: (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) -> Bool Source #(>=) :: (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) -> Bool Source #max :: (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) Source #min :: (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) Source # (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i) => Ord (a, b, c, d, e, f, g, h, i) # Instance detailsDefined in GHC.Classes Methodscompare :: (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) -> Ordering Source #(<) :: (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) -> Bool Source #(<=) :: (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) -> Bool Source #(>) :: (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) -> Bool Source #(>=) :: (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) -> Bool Source #max :: (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) Source #min :: (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) -> (a, b, c, d, e, f, g, h, i) Source # (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j) => Ord (a, b, c, d, e, f, g, h, i, j) # Instance detailsDefined in GHC.Classes Methodscompare :: (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) -> Ordering Source #(<) :: (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) -> Bool Source #(<=) :: (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) -> Bool Source #(>) :: (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) -> Bool Source #(>=) :: (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) -> Bool Source #max :: (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) Source #min :: (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) -> (a, b, c, d, e, f, g, h, i, j) Source # (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k) => Ord (a, b, c, d, e, f, g, h, i, j, k) # Instance detailsDefined in GHC.Classes Methodscompare :: (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) -> Ordering Source #(<) :: (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) -> Bool Source #(<=) :: (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) -> Bool Source #(>) :: (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) -> Bool Source #(>=) :: (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) -> Bool Source #max :: (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) Source #min :: (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) -> (a, b, c, d, e, f, g, h, i, j, k) Source # (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k, Ord l) => Ord (a, b, c, d, e, f, g, h, i, j, k, l) # Instance detailsDefined in GHC.Classes Methodscompare :: (a, b, c, d, e, f, g, h, i, j, k, l) -> (a, b, c, d, e, f, g, h, i, j, k, l) -> Ordering Source #(<) :: (a, b, c, d, e, f, g, h, i, j, k, l) -> (a, b, c, d, e, f, g, h, i, j, k, l) -> Bool Source #(<=) :: (a, b, c, d, e, f, g, h, i, j, k, l) -> (a, b, c, d, e, f, g, h, i, j, k, l) -> Bool Source #(>) :: (a, b, c, d, e, f, g, h, i, j, k, l) -> (a, b, c, d, e, f, g, h, i, j, k, l) -> Bool Source #(>=) :: (a, b, c, d, e, f, g, h, i, j, k, l) -> (a, b, c, d, e, f, g, h, i, j, k, l) -> Bool Source #max :: (a, b, c, d, e, f, g, h, i, j, k, l) -> (a, b, c, d, e, f, g, h, i, j, k, l) -> (a, b, c, d, e, f, g, h, i, j, k, l) Source #min :: (a, b, c, d, e, f, g, h, i, j, k, l) -> (a, b, c, d, e, f, g, h, i, j, k, l) -> (a, b, c, d, e, f, g, h, i, j, k, l) Source # (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k, Ord l, Ord m) => Ord (a, b, c, d, e, f, g, h, i, j, k, l, m) # Instance detailsDefined in GHC.Classes Methodscompare :: (a, b, c, d, e, f, g, h, i, j, k, l, m) -> (a, b, c, d, e, f, g, h, i, j, k, l, m) -> Ordering Source #(<) :: (a, b, c, d, e, f, g, h, i, j, k, l, m) -> (a, b, c, d, e, f, g, h, i, j, k, l, m) -> Bool Source #(<=) :: (a, b, c, d, e, f, g, h, i, j, k, l, m) -> (a, b, c, d, e, f, g, h, i, j, k, l, m) -> Bool Source #(>) :: (a, b, c, d, e, f, g, h, i, j, k, l, m) -> (a, b, c, d, e, f, g, h, i, j, k, l, m) -> Bool Source #(>=) :: (a, b, c, d, e, f, g, h, i, j, k, l, m) -> (a, b, c, d, e, f, g, h, i, j, k, l, m) -> Bool Source #max :: (a, b, c, d, e, f, g, h, i, j, k, l, m) -> (a, b, c, d, e, f, g, h, i, j, k, l, m) -> (a, b, c, d, e, f, g, h, i, j, k, l, m) Source #min :: (a, b, c, d, e, f, g, h, i, j, k, l, m) -> (a, b, c, d, e, f, g, h, i, j, k, l, m) -> (a, b, c, d, e, f, g, h, i, j, k, l, m) Source # (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k, Ord l, Ord m, Ord n) => Ord (a, b, c, d, e, f, g, h, i, j, k, l, m, n) # Instance detailsDefined in GHC.Classes Methodscompare :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> Ordering Source #(<) :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> Bool Source #(<=) :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> Bool Source #(>) :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> Bool Source #(>=) :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> Bool Source #max :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n) Source #min :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n) Source # (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k, Ord l, Ord m, Ord n, Ord o) => Ord (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) # Instance detailsDefined in GHC.Classes Methodscompare :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> Ordering Source #(<) :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> Bool Source #(<=) :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> Bool Source #(>) :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> Bool Source #(>=) :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> Bool Source #max :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) Source #min :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) Source #

Monomorphic equality operators

Matching on class methods (e.g. (==)) in rewrite rules tends to be a bit fragile. For instance, consider this motivating example from the bytestring library,

break :: (Word8 -> Bool) -> ByteString -> (ByteString, ByteString)
breakByte :: Word8 -> ByteString -> (ByteString, ByteString)
{-# RULES "break -> breakByte" forall a. break (== x) = breakByte x #-}


Here we have two functions, with breakByte providing an optimized implementation of break where the predicate is merely testing for equality with a known Word8. As written, however, this rule will be quite fragile as the (==) class operation rule may rewrite the predicate before our break rule has a chance to fire.

For this reason, most of the primitive types in base have Eq and Ord instances defined in terms of helper functions with inlinings delayed to phase 1. For instance, Word8's Eq instance looks like,

instance Eq Word8 where
(==) = eqWord8
(/=) = neWord8

eqWord8, neWord8 :: Word8 -> Word8 -> Bool
eqWord8 (W8# x) (W8# y) = ...
neWord8 (W8# x) (W8# y) = ...
{-# INLINE [1] eqWord8 #-}
{-# INLINE [1] neWord8 #-}


This allows us to save our break rule above by rewriting it to instead match against eqWord8,

{-# RULES "break -> breakByte" forall a. break (eqWord8 x) = breakByte x #-}


Currently this is only done for (==), (/=), (<), (<=), (>), and (>=) for the types in GHC.Word and GHC.Int.

Functions over Bool

(&&) :: Bool -> Bool -> Bool infixr 3 Source #

Boolean "and", lazy in the second argument

(||) :: Bool -> Bool -> Bool infixr 2 Source #

Boolean "or", lazy in the second argument

Boolean "not"