[Haskell-cafe] How to customize dyre recompile?

Andy Stewart lazycat.manatee at gmail.com
Sun Sep 6 01:41:00 EDT 2009


Hi all,

I use below params for configure dyre:

rebootParams :: Params Config
rebootParams = defaultParams
    {projectName = "Main"
    ,realMain    = manatee
    ,showError   = rebootShowError
    ,cacheDir    = Just $ return "/test/Download/cache/"
    ,configDir   = Just getCurrentDirectory
    }

There have two version of function `reboot` to reboot Master binary:

reboot :: IORefObject -> IO ()
reboot ioRefObject = do
  rs <- rebootGetState ioRefObject
  relaunchWithBinaryState rs Nothing

reboot :: IORefObject -> IO ()
reboot ioRefObject = do
  output <- customCompile rebootParams
  case output of
    Just o -> putStrLn o   -- output recompile error
    Nothing -> do          -- otherwise relaunch
      rs <- rebootGetState ioRefObject
      relaunchWithBinaryState rs Nothing

Becuase i setup `projectName` with `Main`, so i want `dyre` recompile
NECESSARY module when i change any module in my project.

In first version of function `reboot`, i just use
`relauncheWithBinaryState`, i found `dyre` just recompile all project when i
modified Main.hs, if i modified any others module in project, `dyre`
won't recompile those modified modules.

In second version, i use `customCompile` for recompile, but this have
another problem, `customComiple` use `-fforce-recomp` flags to remove
all object files, so function `customComiple` will recompile all modules
in project, and not just recompile NECESSARY modules.

So how to make `dyre` just recompile NECCESSARY modules whatever i
change any modules in project?

Maybe add new option "--dyre-reconf-necessary" in `dyre`?

Thanks!

  -- Andy



More information about the Haskell-Cafe mailing list