Move the Char datatype into ghc-prim
[ghc-base.git] / GHC / Base.lhs
index 5d95a04..b18215b 100644 (file)
@@ -62,7 +62,7 @@ GHC.Float       Classes: Floating, RealFloat
 Other Prelude modules are much easier with fewer complex dependencies.
 
 \begin{code}
-{-# OPTIONS_GHC -fno-implicit-prelude #-}
+{-# OPTIONS_GHC -XNoImplicitPrelude #-}
 {-# OPTIONS_HADDOCK hide #-}
 -----------------------------------------------------------------------------
 -- |
@@ -87,11 +87,13 @@ module GHC.Base
         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
@@ -99,7 +101,7 @@ import GHC.Prim
 import {-# SOURCE #-} GHC.Err
 
 infixr 9  .
-infixr 5  ++, :
+infixr 5  ++
 infix  4  ==, /=, <, <=, >=, >
 infixr 3  &&
 infixr 2  ||
@@ -274,9 +276,8 @@ class  Monad m  where
 %*********************************************************
 
 \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] #-}
@@ -522,39 +523,6 @@ otherwise               =  True
 
 %*********************************************************
 %*                                                      *
-\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@}
 %*                                                      *
 %*********************************************************
@@ -607,7 +575,6 @@ To convert a 'Char' to or from the corresponding 'Int' value defined
 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
@@ -651,7 +618,7 @@ String equality is used when desugaring pattern-matches against strings.
 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:
@@ -761,7 +728,7 @@ inline x = x
 --      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