exporting functions which raise exceptions

Alastair Reid reid at cs.utah.edu
Wed Jun 12 08:55:05 EDT 2002


Suppose I foreign export (or wrap) a Haskell function and that
function raises an exception, calls exit or raises an error.  

How should this be reflected on the C side?

In a batch-mode system (ghc, runhugs, nhc), we need to call a
no_return function like exit but should it always be exit or should
there be a way for an application to register an alternative function?
(e.g., If my Basic interpreter makes a foreign function call into
Haskell, I'd like an error in Haskell to bring me back to the Basic
REPL not to quit my program).

In an interactive system (ghci, Hugs), the right thing to do seems to
be to return to the interpreters REPL.

-- 
Alastair Reid        reid at cs.utah.edu        http://www.cs.utah.edu/~reid/



More information about the FFI mailing list