X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=GHC%2FBase.lhs;h=b18215b79cd5893726c2839b0cf33e9ac57881bf;hb=39b3f52fb874e64fffb0082315a541e6870676f7;hp=bd1b76ac8591a3d27845ccc9c1365eaa0c378075;hpb=10de2c656f74562b662c22928be85e1b3ccda796;p=ghc-base.git diff --git a/GHC/Base.lhs b/GHC/Base.lhs index bd1b76a..b18215b 100644 --- a/GHC/Base.lhs +++ b/GHC/Base.lhs @@ -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