GHC does not generate binary code, despite the absence of errors

GHC tells me that it worked, but it does not generate a binary. I do not know why

$ ls total 8 -rw-r--r-- 1 drewgross staff 361B 9 Sep 01:21 MouseMove.hs $ ghc MouseMove.hs [1 of 1] Compiling MouseMove ( MouseMove.hs, MouseMove.o ) $ echo $? 0 $ ls total 32 -rw-r--r-- 1 drewgross staff 926B 9 Sep 01:29 MouseMove.hi -rw-r--r-- 1 drewgross staff 361B 9 Sep 01:21 MouseMove.hs -rw-r--r-- 1 drewgross staff 5.7K 9 Sep 01:29 MouseMove.o 

Here is my MouseMove.hs file:

 {-# LANGUAGE ForeignFunctionInterface #-} module MouseMove where import Foreign import Foreign.C.Types import Control.Applicative foreign import ccall "/System/Library/Frameworks/CoreGraphics.framework/Versions/A/Headers/CGRemoteOperation.h CGWarpMouseCursorPosition" c_warp :: CFloat -> CFloat -> IO CInt main = print =<< (fromIntegral <$> c_warp 100 100) 

and my version of ghc

 $ ghc --version The Glorious Glasgow Haskell Compilation System, version 7.6.3 

Any ideas? Without an error message, I do not know what to try.

+7
haskell ghc ffi
source share
1 answer

GHC will create a program if it has a module named Main and a function called Main . In your case, you have Main , but not Main .

Either remove the module MouseMove header from MouseMove.hs , or pass -main-is MouseMove.main to the GHC.

+13
source share

All Articles