From c3c5bee6961d5d94b900c6f430f8770262688ac5 Mon Sep 17 00:00:00 2001 From: "simonpj@microsoft.com" Date: Tue, 14 Sep 2010 13:46:39 +0000 Subject: Add absentError. This patch accompanies the HEAD patch: Tue Sep 14 12:38:27 BST 2010 simonpj@microsoft.com * Make absent-arg wrappers work for unlifted types (fix Trac #4306) Previously we were simply passing arguments of unlifted type to a wrapper, even if they were absent, which was stupid. See Note [Absent error Id] in WwLib. --- libraries/base/Control/Exception/Base.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'libraries/base/Control/Exception') diff --git a/libraries/base/Control/Exception/Base.hs b/libraries/base/Control/Exception/Base.hs index 1dc668b398..8ea4bf4bda 100644 --- a/libraries/base/Control/Exception/Base.hs +++ b/libraries/base/Control/Exception/Base.hs @@ -109,6 +109,7 @@ module Control.Exception.Base ( -- * Calls for GHC runtime recSelError, recConError, irrefutPatError, runtimeError, nonExhaustiveGuardsError, patError, noMethodBindingError, + absentError, nonTermination, nestedAtomically, #endif ) where @@ -705,12 +706,14 @@ instance Exception NestedAtomically #ifdef __GLASGOW_HASKELL__ recSelError, recConError, irrefutPatError, runtimeError, - nonExhaustiveGuardsError, patError, noMethodBindingError + nonExhaustiveGuardsError, patError, noMethodBindingError, + absentError :: Addr# -> a -- All take a UTF8-encoded C string recSelError s = throw (RecSelError ("No match in record selector " ++ unpackCStringUtf8# s)) -- No location info unfortunately runtimeError s = error (unpackCStringUtf8# s) -- No location info unfortunately +absentError s = error ("Oops! Entered absent arg " ++ unpackCStringUtf8# s) nonExhaustiveGuardsError s = throw (PatternMatchFail (untangle s "Non-exhaustive guards in")) irrefutPatError s = throw (PatternMatchFail (untangle s "Irrefutable pattern failed for pattern")) -- cgit v1.2.1