From f5876f9fc3651f757556ca9c78ade3e253639b33 Mon Sep 17 00:00:00 2001 From: "simonpj@microsoft.com" Date: Tue, 14 Sep 2010 13:46:39 +0000 Subject: [PATCH] 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. --- Control/Exception/Base.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Control/Exception/Base.hs b/Control/Exception/Base.hs index 1dc668b..8ea4bf4 100644 --- a/Control/Exception/Base.hs +++ b/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")) -- 1.7.10.4