[C2hs] Passing extra arguments to marshalling functions
bringert at cs.chalmers.se
Fri Jun 1 12:43:00 EDT 2007
I have a function for checking return values of functions:
checkResult :: String -> CInt -> IO ()
checkResult _ 0 = return ()
checkResult f n = fail $ f ++ " failed (" ++ show n ++ ")"
Now, I want to call that on the exit value of lots of functions, like this:
-> `()' `checkResult "foo"'*- #}
-> `()' `checkResult "bar"'*- #}
However, the marshallers can only be function names, not arbitrary
expressions. Wouldn't it be a useful generalization to allow arbitrary
expressions as marshallers? That way you could even have one-off
marshallers as lambda expressions.
More information about the C2hs