%*********************************************************
\begin{code}
--- |The 'Bool' type is an enumeration. It is defined with 'False'
--- first so that the corresponding 'Prelude.Enum' instance will give
--- 'Prelude.fromEnum' 'False' the value zero, and
--- 'Prelude.fromEnum' 'True' the value 1.
--- The actual definition is in the ghc-prim package.
-
--- XXX These don't work:
--- deriving instance Eq Bool
--- deriving instance Ord Bool
--- <wired into compiler>:
--- Illegal binding of built-in syntax: con2tag_Bool#
-
-instance Eq Bool where
- True == True = True
- False == False = True
- _ == _ = False
-
-instance Ord Bool where
- compare False True = LT
- compare True False = GT
- compare _ _ = EQ
-
--- Read is in GHC.Read, Show in GHC.Show
-
-- |'otherwise' is defined as the value 'True'. It helps to make
-- guards more readable. eg.
--
x == y = not (x /= y)
-- XXX This doesn't work:
+-- deriving instance Eq Bool
+-- <wired into compiler>:
+-- Illegal binding of built-in syntax: con2tag_Bool#
+instance Eq Bool where
+ True == True = True
+ False == False = True
+ _ == _ = False
+
+-- XXX This doesn't work:
-- deriving instance Eq Ordering
-- Illegal binding of built-in syntax: con2tag_Ordering#
instance Eq Ordering where
min x y = if x <= y then x else y
-- XXX This doesn't work:
+-- deriving instance Ord Bool
+-- <wired into compiler>:
+-- Illegal binding of built-in syntax: con2tag_Bool#
+instance Ord Bool where
+ compare False True = LT
+ compare True False = GT
+ compare _ _ = EQ
+
+-- XXX This doesn't work:
-- deriving instance Ord Ordering
-- Illegal binding of built-in syntax: con2tag_Ordering#
instance Ord Ordering where