Other Prelude modules are much easier with fewer complex dependencies.
\begin{code}
-{-# OPTIONS_GHC -fno-implicit-prelude #-}
+{-# OPTIONS_GHC -XNoImplicitPrelude #-}
{-# OPTIONS_HADDOCK hide #-}
-----------------------------------------------------------------------------
-- |
module GHC.Bool,
module GHC.Generics,
module GHC.Ordering,
+ module GHC.Types,
module GHC.Prim, -- Re-export GHC.Prim and GHC.Err, to avoid lots
module GHC.Err -- of people having to import it explicitly
)
where
+import GHC.Types
import GHC.Bool
import GHC.Generics
import GHC.Ordering
import {-# SOURCE #-} GHC.Err
infixr 9 .
-infixr 5 ++, :
+infixr 5 ++
infix 4 ==, /=, <, <=, >=, >
infixr 3 &&
infixr 2 ||
%*********************************************************
\begin{code}
-data [] a = [] | a : [a] -- do explicitly: deriving (Eq, Ord)
- -- to avoid weird names like con2tag_[]#
-
+-- do explicitly: deriving (Eq, Ord)
+-- to avoid weird names like con2tag_[]#
instance (Eq a) => Eq [a] where
{-# SPECIALISE instance Eq [Char] #-}
%*********************************************************
%* *
-\subsection{The @()@ type}
-%* *
-%*********************************************************
-
-The Unit type is here because virtually any program needs it (whereas
-some programs may get away without consulting GHC.Tup). Furthermore,
-the renamer currently *always* asks for () to be in scope, so that
-ccalls can use () as their default type; so when compiling GHC.Base we
-need (). (We could arrange suck in () only if -fglasgow-exts, but putting
-it here seems more direct.)
-
-\begin{code}
--- | The unit datatype @()@ has one non-undefined member, the nullary
--- constructor @()@.
-data () = ()
-
-instance Eq () where
- () == () = True
- () /= () = False
-
-instance Ord () where
- () <= () = True
- () < () = False
- () >= () = True
- () > () = False
- max () () = ()
- min () () = ()
- compare () () = EQ
-\end{code}
-
-
-%*********************************************************
-%* *
\subsection{Type @Ordering@}
%* *
%*********************************************************
by Unicode, use 'Prelude.toEnum' and 'Prelude.fromEnum' from the
'Prelude.Enum' class respectively (or equivalently 'ord' and 'chr').
-}
-data Char = C# Char#
-- We don't use deriving for Eq and Ord, because for Ord the derived
-- instance defines only compare, which takes two primops. Then
eqString :: String -> String -> Bool
eqString [] [] = True
eqString (c1:cs1) (c2:cs2) = c1 == c2 && cs1 `eqString` cs2
-eqString cs1 cs2 = False
+eqString _ _ = False
{-# RULES "eqString" (==) = eqString #-}
-- eqString also has a BuiltInRule in PrelRules.lhs:
-- but from Template Haskell onwards it's simply
-- defined here in Base.lhs
assert :: Bool -> a -> a
-assert pred r = r
+assert _pred r = r
breakpoint :: a -> a
breakpoint r = r