Add absentError.
authorsimonpj@microsoft.com <unknown>
Tue, 14 Sep 2010 13:46:39 +0000 (13:46 +0000)
committersimonpj@microsoft.com <unknown>
Tue, 14 Sep 2010 13:46:39 +0000 (13:46 +0000)
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

index 1dc668b..8ea4bf4 100644 (file)
@@ -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"))