      libTs <- mapM getModTime . Prelude.filter isSource =<< allFiles lib
      srcT <- getModTime src
      binT <- getModTime bin
-@@ -460,7 +462,7 @@
+@@ -471,7 +473,7 @@ recompile force = io $ do
          -- temporarily disable SIGCHLD ignoring:
          uninstallSignalHandlers
          status <- bracket (openFile err WriteMode) hClose $ \h ->
--            waitForProcess =<< runProcess "ghc" ["--make", "xmonad.hs", "-i", "-ilib", "-fforce-recomp", "-v0", "-o",binn] (Just dir)
-+            waitForProcess =<< runProcess ghc ["--make", "xmonad.hs", "-i", "-ilib", "-fforce-recomp", "-v0", "-o",binn] (Just dir)
+-            waitForProcess =<< runProcess "ghc" ["--make", "xmonad.hs", "-i", "-ilib", "-fforce-recomp", "-main-is", "main", "-v0", "-o",binn] (Just dir)
++            waitForProcess =<< runProcess ghc ["--make", "xmonad.hs", "-i", "-ilib", "-fforce-recomp", "-main-is", "main", "-v0", "-o",binn] (Just dir)
                                      Nothing Nothing Nothing (Just h)
  
          -- re-enable SIGCHLD:
-@@ -469,6 +471,7 @@
+@@ -480,6 +482,7 @@ recompile force = io $ do
          -- now, if it fails, run xmessage to let the user know:
          when (status /= ExitSuccess) $ do
              ghcErr <- readFile err

 import Graphics.X11.Xlib
 import Graphics.X11.Xlib.Extras (Event)
 import Data.Typeable
@@ -452,6 +453,7 @@
         err  = base ++ ".errors"
         src  = base ++ ".hs"
         lib  = dir </> "lib"

--- a/src/XMonad/Core.hs
+++ b/src/XMonad/Core.hs
@@ -48,6 +48,7 @@ import System.Posix.Types (ProcessID)
 import System.Process
 import System.Directory
 import System.Exit
