On Wed, 2004-06-23 at 01:13, Duncan Coutts wrote:
> 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)
In the meantime (before a proper solution) here's a quick hack so you
can at least find the error message associated with the call to fail.
This patch is against recent ghc CVS:
===================================================================
RCS file: /cvs/fptools/ghc/compiler/utils/IOEnv.hs,v
retrieving revision 1.2
diff -C2 -r1.2 IOEnv.hs
*** IOEnv.hs 12 Jan 2004 15:47:53 -0000 1.2
--- IOEnv.hs 29 Jun 2004 15:30:10 -0000
***************
*** 45,49 ****
(>>) = thenM_
return = returnM
! fail s = failM -- Ignore the string
returnM :: a -> IOEnv env a
--- 45,49 ----
(>>) = thenM_
return = returnM
! fail s = failMWithMessage s
returnM :: a -> IOEnv env a
***************
*** 60,63 ****
--- 60,65 ----
failM = IOEnv (\ env -> ioError (userError "IOEnv failure"))
+ failMWithMessage :: String -> IOEnv env a
+ failMWithMessage msg = IOEnv (\ env -> ioError (userError $ "IOEnv failure: " ++
msg))
_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs