Peter Amstutz <[EMAIL PROTECTED]> wrote, > I'm experimenting with the haskell FFI, and have run into a odd little > problem. For some reason, ghc won't let me import functions with no > arguments... > [...] > And my first try (for.hs) > > foreign import ccall "hiworld.so" "hiworld" hiworld :: () -> IO () > > main = hiworld () > > and I get: > $ ghc for.hs hw.so -fglasgow-exts > for.hs:5: > Unacceptable argument type in foreign declaration: () > When checking declaration: > foreign import _ccall "hiworld.so" "hiworld" hiworld :: () -> IO > () Try foreign import ccall "hiworld.so" "hiworld" hiworld :: IO () In other words, a function of no arguments is a constant. Remember that evaluating a monad expression of `IO ()' does not yet execute the I/O operation - it merely produces an ``action'' that, once executed, performs the I/O operation. This is a fine, but very important difference. Manuel
Re: calling void foo(void) C functions from haskell
Manuel M. T. Chakravarty Mon, 12 Jul 1999 05:25:05 +0200 (MET DST)
- calling void foo(void) C functions from haskell Peter Amstutz
- Manuel M. T. Chakravarty