More compact error messages for record selectors
authorsimonpj@microsoft.com <unknown>
Fri, 2 Jan 2009 14:53:25 +0000 (14:53 +0000)
committersimonpj@microsoft.com <unknown>
Fri, 2 Jan 2009 14:53:25 +0000 (14:53 +0000)
Make recSelError generate the standard part of the record selector
error message (i.e. "No match in record selector") rather than have
that string duplicated for every record selector.

Control/Exception/Base.hs

index b6893fb..f9f20f8 100644 (file)
@@ -669,8 +669,9 @@ recSelError, recConError, irrefutPatError, runtimeError,
              nonExhaustiveGuardsError, patError, noMethodBindingError
         :: Addr# -> a   -- All take a UTF8-encoded C string
 
-recSelError              s = throw (RecSelError (unpackCStringUtf8# s)) -- No location info unfortunately
-runtimeError             s = error (unpackCStringUtf8# s)               -- No location info unfortunately
+recSelError              s = throw (RecSelError ("No match in record selector "
+                                                ++ unpackCStringUtf8# s))  -- No location info unfortunately
+runtimeError             s = error (unpackCStringUtf8# s)                   -- No location info unfortunately
 
 nonExhaustiveGuardsError s = throw (PatternMatchFail (untangle s "Non-exhaustive guards in"))
 irrefutPatError          s = throw (PatternMatchFail (untangle s "Irrefutable pattern failed for pattern"))