X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=GHC%2FErr.lhs;h=803fdf0b518a5a6f1865227642a2451e0b2f7555;hb=19de173b1bd4fa8cf1854cfefa619565910137f3;hp=43834aa5698b3000ed2de7e9582e05ae7425d20c;hpb=3d2db48412b8f469ba4943f95b0dce9354de4afb;p=ghc-base.git diff --git a/GHC/Err.lhs b/GHC/Err.lhs index 43834aa..803fdf0 100644 --- a/GHC/Err.lhs +++ b/GHC/Err.lhs @@ -30,6 +30,7 @@ module GHC.Err , runtimeError -- :: Addr# -> a -- Addr# points to UTF8 encoded C string , absentErr -- :: a + , divZeroError -- :: a , error -- :: String -> a , assertError -- :: String -> Bool -> a -> a @@ -51,12 +52,13 @@ import GHC.Exception %********************************************************* \begin{code} --- error stops execution and displays an error message +-- | 'error' stops execution and displays an error message. error :: String -> a error s = throw (ErrorCall s) +-- | A special case of 'error'. -- It is expected that compilers will recognize this and insert error --- messages which are more appropriate to the context in which undefined +-- messages which are more appropriate to the context in which 'undefined' -- appears. undefined :: a @@ -126,3 +128,13 @@ untangle coded message } not_bar c = c /= '|' \end{code} + +Divide by zero. We put it here because it is needed relatively early +in the libraries before the Exception type has been defined yet. + +\begin{code} +{-# NOINLINE divZeroError #-} +divZeroError :: a +divZeroError = throw (ArithException DivideByZero) +\end{code} +