[project @ 2001-05-21 11:02:15 by simonmar]
[ghc-hetmet.git] / ghc / lib / std / PrelErr.lhs
index c0269cd..cd6a56f 100644 (file)
@@ -1,5 +1,7 @@
+% -----------------------------------------------------------------------------
+% $Id: PrelErr.lhs,v 1.19 2001/05/18 16:54:05 simonmar Exp $
 %
-% (c) The AQUA Project, Glasgow University, 1994-1996
+% (c) The University of Glasgow, 1994-2000
 %
 
 \section[PrelErr]{Module @PrelErr@}
@@ -29,6 +31,7 @@ module PrelErr
        , error                    -- :: String -> a
        , assertError              -- :: String -> Bool -> a -> a
        
+       , undefined                -- :: a
        ) where
 
 import PrelBase
@@ -46,6 +49,13 @@ import PrelException
 -- error stops execution and displays an error message
 error :: String -> a
 error s = throw (ErrorCall s)
+
+-- It is expected that compilers will recognize this and insert error
+-- messages which are more appropriate to the context in which undefined 
+-- appears. 
+
+undefined :: a
+undefined =  error "Prelude.undefined"
 \end{code}
 
 %*********************************************************
@@ -77,7 +87,7 @@ irrefutPatError
 
 noMethodBindingError     s = throw (NoMethodError (untangle s "No instance nor default method for class operation"))
 irrefutPatError                 s = throw (PatternMatchFail (untangle s "Irrefutable pattern failed for pattern"))
-nonExhaustiveGuardsError s = throw (NonExhaustiveGuards (untangle s "Non-exhaustive guards in"))
+nonExhaustiveGuardsError s = throw (PatternMatchFail (untangle s "Non-exhaustive guards in"))
 patError                s = throw (PatternMatchFail (untangle s "Non-exhaustive patterns in"))
 recSelError             s = throw (RecSelError (untangle s "Missing field in record selection"))
 recConError             s = throw (RecConError (untangle s "Missing field in record construction"))