문제

GHC is telling me it worked, yet it doesn't generate a binary. I don't 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 GHC version is

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

Any ideas? Without an error message I don't know what to try.

도움이 되었습니까?

해결책

GHC will create a program if there is a module named Main and a function named main inside it. In your case you have main, but not in Main.

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top