Repository : ssh://darcs.haskell.org//srv/darcs/packages/base On branch : master
http://hackage.haskell.org/trac/ghc/changeset/25de47e226cbf44b28b4201fb84e43b7e50f3edc >--------------------------------------------------------------- commit 25de47e226cbf44b28b4201fb84e43b7e50f3edc Author: Paolo Capriotti <[email protected]> Date: Thu Jul 5 19:50:34 2012 +0100 Make numeric rules builtin. Move rules in GHC.Base to PrelRules and convert them to BuiltinRules. >--------------------------------------------------------------- GHC/Base.lhs | 68 ---------------------------------------------------------- 1 files changed, 0 insertions(+), 68 deletions(-) diff --git a/GHC/Base.lhs b/GHC/Base.lhs index c6c21d6..8114a0e 100644 --- a/GHC/Base.lhs +++ b/GHC/Base.lhs @@ -448,15 +448,6 @@ otherwise = True -- type String = [Char] -{-# RULES -"x# `eqChar#` x#" forall x#. x# `eqChar#` x# = True -"x# `neChar#` x#" forall x#. x# `neChar#` x# = False -"x# `gtChar#` x#" forall x#. x# `gtChar#` x# = False -"x# `geChar#` x#" forall x#. x# `geChar#` x# = True -"x# `leChar#` x#" forall x#. x# `leChar#` x# = True -"x# `ltChar#` x#" forall x#. x# `ltChar#` x# = False - #-} - unsafeChr :: Int -> Char unsafeChr (I# i#) = C# (chr# i#) @@ -685,65 +676,6 @@ x# `divModInt#` y# (# q, r #) -> (# q -# 1#, r +# y# -# 1# #) | otherwise = x# `quotRemInt#` y# -{-# RULES -"x# +# 0#" forall x#. x# +# 0# = x# -"0# +# x#" forall x#. 0# +# x# = x# -"x# -# 0#" forall x#. x# -# 0# = x# -"x# -# x#" forall x#. x# -# x# = 0# -"x# *# 0#" forall x#. x# *# 0# = 0# -"0# *# x#" forall x#. 0# *# x# = 0# -"x# *# 1#" forall x#. x# *# 1# = x# -"1# *# x#" forall x#. 1# *# x# = x# - #-} - -{-# RULES -"x# ># x#" forall x#. x# ># x# = False -"x# >=# x#" forall x#. x# >=# x# = True -"x# ==# x#" forall x#. x# ==# x# = True -"x# /=# x#" forall x#. x# /=# x# = False -"x# <# x#" forall x#. x# <# x# = False -"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# -"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# -"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# - #-} - -{- -We'd like to have more rules, but for example: - -This gives wrong answer (0) for NaN - NaN (should be NaN): - "minusDouble x x" forall x#. (-##) x# x# = 0.0## - -This gives wrong answer (0) for 0 * NaN (should be NaN): - "timesDouble 0.0 x" forall x#. (*##) 0.0## x# = 0.0## - -This gives wrong answer (0) for NaN * 0 (should be NaN): - "timesDouble x 0.0" forall x#. (*##) x# 0.0## = 0.0## - -These are tested by num014. - -Similarly for Float (#5178): - -"minusFloat x x" forall x#. minusFloat# x# x# = 0.0# -"timesFloat0.0 x" forall x#. timesFloat# 0.0# x# = 0.0# -"timesFloat x 0.0" forall x#. timesFloat# x# 0.0# = 0.0# --} - -- 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 _______________________________________________ Cvs-libraries mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-libraries
