From: simonpj@microsoft.com Date: Fri, 3 Apr 2009 09:11:18 +0000 (+0000) Subject: Import GHC.Err so we see bottoming functions properly X-Git-Tag: 2009-06-25~41 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=95087a4ef4877a0860331cac2eafab481158bd60;p=ghc-base.git Import GHC.Err so we see bottoming functions properly Before this patch, GHC/Err.lhs-boot exported divZeroError and overflowError, as well as plain 'error'. The latter has a wired-in defn in GHC (MkId.lhs), but the former two do not. As a result GHC doesn't see that overflowError is a bottoming function at a crucial moment when compiling GHC.Real, and that means that divMod wasn't getting the CPR property. The fix is easy: - GHC/Err.lhs-boot should export only 'error' - GHC.Real, GHC.Int, and GHC.Word should import GHC.Err directly. They can do this nowadays without creating a module loop, thanks to the new exception story --- diff --git a/GHC/Err.lhs-boot b/GHC/Err.lhs-boot index 0b18d30..9bef80d 100644 --- a/GHC/Err.lhs-boot +++ b/GHC/Err.lhs-boot @@ -4,7 +4,7 @@ -- Ghc.Err.hs-boot --------------------------------------------------------------------------- -module GHC.Err( error, divZeroError, overflowError ) where +module GHC.Err( error ) where -- The type signature for 'error' is a gross hack. -- First, we can't give an accurate type for error, because it mentions @@ -17,10 +17,4 @@ module GHC.Err( error, divZeroError, overflowError ) where -- to mention 'error' so that it gets exported from this .hi-boot -- file. error :: a - --- divide by zero is needed quite early -divZeroError :: a - --- overflow is needed quite early -overflowError :: a \end{code} diff --git a/GHC/Int.hs b/GHC/Int.hs index 2a5b839..ae49806 100644 --- a/GHC/Int.hs +++ b/GHC/Int.hs @@ -37,6 +37,7 @@ import GHC.Num import GHC.Real import GHC.Read import GHC.Arr +import GHC.Err import GHC.Word hiding (uncheckedShiftL64#, uncheckedShiftRL64#) import GHC.Show diff --git a/GHC/Real.lhs b/GHC/Real.lhs index aa00ccb..eca9974 100644 --- a/GHC/Real.lhs +++ b/GHC/Real.lhs @@ -24,6 +24,7 @@ import GHC.Num import GHC.List import GHC.Enum import GHC.Show +import GHC.Err infixr 8 ^, ^^ infixl 7 /, `quot`, `rem`, `div`, `mod` diff --git a/GHC/Word.hs b/GHC/Word.hs index 68afadf..8d63e11 100644 --- a/GHC/Word.hs +++ b/GHC/Word.hs @@ -41,6 +41,7 @@ import GHC.Real import GHC.Read import GHC.Arr import GHC.Show +import GHC.Err ------------------------------------------------------------------------ -- Helper functions