ghc makes it's own type checker monad TcM an instance of the Quasi class
(which is rather cunning), however this means that if the user calls the
Monad function 'fail' then the internal TcM fail method gets called.
This monad (IOEnv) was never meant to fail (see
ghc/compiler/utils/IOEnv.hs/) so the error message is:

Exception when trying to run compile-time code:
        Code: genex_count
        Exn: user error (IOEnv failure)

Of course the user code should be using 'report', but if you're using
old code, or code that is generic in the monad it uses then people will
end up calling fail.

Perhaps the thing to do is to wrap splices in an exception handler and
convert 'fail's into a 'report' instead.

The same should probably be done for errors raised in pure code by
calling 'error'. At the moment it gives an overly panicky report
(although at least it passes the user's error message through):

ghc-6.3: panic! (the `impossible' happened, GHC version 6.3):
        where clauses & gaurds not yet supprted in function definitions

The error message there is generated by my code (hence the spelling
errors :-) ).

Duncan

_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to