[project @ 2002-05-09 13:09:30 by simonmar]
[haskell-directory.git] / GHC / Base.lhs
index b4961ae..b19e83a 100644 (file)
@@ -1,11 +1,5 @@
-% -----------------------------------------------------------------------------
-% $Id: Base.lhs,v 1.5 2002/02/05 17:32:26 simonmar Exp $
-%
-% (c) The University of Glasgow, 1992-2000
-%
 \section[GHC.Base]{Module @GHC.Base@}
 
-
 The overall structure of the GHC Prelude is a bit tricky.
 
   a) We want to avoid "orphan modules", i.e. ones with instance
@@ -71,9 +65,21 @@ GHC.ByteArr  Types: ByteArray, MutableByteArray
 
 Other Prelude modules are much easier with fewer complex dependencies.
 
-
 \begin{code}
 {-# OPTIONS -fno-implicit-prelude #-}
+-----------------------------------------------------------------------------
+-- |
+-- Module      :  GHC.Base
+-- Copyright   :  (c) The University of Glasgow, 1992-2002
+-- License     :  see libraries/base/LICENSE
+-- 
+-- Maintainer  :  cvs-ghc@haskell.org
+-- Stability   :  internal
+-- Portability :  non-portable (GHC extensions)
+--
+-- Basic data types and classes.
+-- 
+-----------------------------------------------------------------------------
 
 #include "MachDeps.h"
 
@@ -85,7 +91,7 @@ module GHC.Base
   ) 
        where
 
-import {-# SOURCE #-} GHC.Prim
+import GHC.Prim
 import {-# SOURCE #-} GHC.Err
 
 infixr 9  .
@@ -599,8 +605,10 @@ instance CReturnable () -- Why, exactly?
 
 \begin{code}
 data Unit = Unit
-data a :+: b = Inl a | Inr b
-data a :*: b = a :*: b
+#ifndef __HADDOCK__
+data (:+:) a b = Inl a | Inr b
+data (:*:) a b = a :*: b
+#endif
 \end{code}
 
 
@@ -692,6 +700,30 @@ gtInt, geInt, eqInt, neInt, ltInt, leInt :: Int -> Int -> Bool
 "x# <=# x#" forall x#. x# <=# x# = True
   #-}
 
+{-# RULES
+"plusFloat x 0.0"   forall x#. plusFloat#  x#   0.0# = x#
+"plusFloat 0.0 x"   forall x#. plusFloat#  0.0# x#   = x#
+"minusFloat x 0.0"  forall x#. minusFloat# x#   0.0# = x#
+"minusFloat x x"    forall x#. minusFloat# x#   x#   = 0.0#
+"timesFloat x 0.0"  forall x#. timesFloat# x#   0.0# = 0.0#
+"timesFloat0.0 x"   forall x#. timesFloat# 0.0# x#   = 0.0#
+"timesFloat x 1.0"  forall x#. timesFloat# x#   1.0# = x#
+"timesFloat 1.0 x"  forall x#. timesFloat# 1.0# x#   = x#
+"divideFloat x 1.0" forall x#. divideFloat# x#  1.0# = x#
+  #-}
+
+{-# RULES
+"plusDouble x 0.0"   forall x#. (+##) x#    0.0## = x#
+"plusDouble 0.0 x"   forall x#. (+##) 0.0## x#    = x#
+"minusDouble x 0.0"  forall x#. (-##) x#    0.0## = x#
+"minusDouble x x"    forall x#. (-##) x#    x#    = 0.0##
+"timesDouble x 0.0"  forall x#. (*##) x#    0.0## = 0.0##
+"timesDouble 0.0 x"  forall x#. (*##) 0.0## x#    = 0.0##
+"timesDouble x 1.0"  forall x#. (*##) x#    1.0## = x#
+"timesDouble 1.0 x"  forall x#. (*##) 1.0## x#    = x#
+"divideDouble x 1.0" forall x#. (/##) x#    1.0## = x#
+  #-}
+
 -- Wrappers for the shift operations.  The uncheckedShift# family are
 -- undefined when the amount being shifted by is greater than the size
 -- in bits of Int#, so these wrappers perform a check and return