[work around unhandled runtime error passing by catchError
Helmut Grohne <grohne@cs.uni-bonn.de>**20140108073945
 Ignore-this: 60b21165b086517cb697ed19c7fe368e
] hunk ./src/Syntax/UnifyExp.hs 84
-nomatch l s = fail $ "Expressions." ++ l ++ ": No Match! " ++ s
+{- *** gross hack ahead ***
+ -
+ - In base 4.3 the behaviour of fail (originally used here) changed. While
+ - previously in a few Monads (notably Either) a failured created by fail could
+ - be handled using catchError, this is no longer the case. Thus a failure
+ - generated here passes by the catchError in the definition of matches. We
+ - therefore need to use throwError here. Unfortunately we do not know Error e,
+ - so there is no way to create a parameter to throwError. So instead we pass
+ - an error value to throwError itself. In the normal case (catchError), the
+ - throwError will be handled and its parameter remain unevaluated. Should it
+ - ever go unhandled, the printing of the error will fail and the inner error
+ - will be printed.
+ -
+ -}
+nomatch :: MonadError e m => String -> String -> m a
+nomatch l s = throwError . error $ "Expressions." ++ l ++ ": No Match! " ++ s