Repository : ssh://darcs.haskell.org//srv/darcs/packages/haskell98 On branch : master
http://hackage.haskell.org/trac/ghc/changeset/34e290a011f2df676a5d655438999634f261502c >--------------------------------------------------------------- commit 34e290a011f2df676a5d655438999634f261502c Author: Daniel Fischer <[email protected]> Date: Tue May 17 23:01:47 2011 +0200 Add old behaviour of gcd The behaviour of gcd was changed to "gcd 0 0 = 0", here we must keep the haskell98 behaviour and raise an error. >--------------------------------------------------------------- Prelude.hs | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/Prelude.hs b/Prelude.hs index a09a300..44342a0 100644 --- a/Prelude.hs +++ b/Prelude.hs @@ -151,7 +151,8 @@ import GHC.Base import Text.Read import GHC.Enum import GHC.Num -import GHC.Real +import GHC.Real hiding ( gcd ) +import qualified GHC.Real ( gcd ) import GHC.Float import GHC.Show import GHC.Err ( undefined ) @@ -207,3 +208,11 @@ seq _ y = y catch :: IO a -> (IOError -> IO a) -> IO a catch = New.catch +#ifdef __GLASGOW_HASKELL__ +-- | @'gcd' x y@ is the greatest (positive) integer that divides both @x@ +-- and @y@; for example @'gcd' (-3) 6@ = @3@, @'gcd' (-3) (-6)@ = @3@, +-- @'gcd' 0 4@ = @4@. @'gcd' 0 0@ raises a runtime error. +gcd :: (Integral a) => a -> a -> a +gcd 0 0 = error "Prelude.gcd: gcd 0 0 is undefined" +gcd x y = GHC.Real.gcd x y +#endif _______________________________________________ Cvs-libraries mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-libraries
