[Haskell-cafe] Re: How to customize dyre recompile?

Will Donnelly will.donnelly at gmail.com
Sun Sep 6 11:37:05 EDT 2009


Hi Andy,

I feel that I should offer a disclaimer here: You are misusing Dyre
somewhat by attempting to make it handle whole-program recompilation.
It is designed to recompile a single configuration file, generally
against an installed library form of the application. Some of its
code, specifically the part that decides when to recompile, is based
almost entirely on this assumption.

That aside, you should be able to accomplish your goals like this:

1. Set the 'forceRecomp' parameter (just added in Dyre 0.7.3) to
'False'. This will remove the '-fforce-recomp' flag from GHC's
options.
2. Run your executable with the '--force-reconf' flag, which will
cause Dyre to always enter the recompilation code.

In a test project I just created, this seems to do what you desire.

Hope this helps clear things up
- Will Donnelly

On Sun, Sep 6 2009 at 1:41 PM, Andy Stewart <lazycat.manatee at gmail.com> wrote:
>
> 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