doCorePass

Max Bolingbroke batterseapower at hotmail.com
Wed Apr 1 18:49:34 EDT 2009


2009/4/1 Colin Paul Adams <colin at colina.demon.co.uk>:
> Between 6.8 and 6.11, function doCorePass in module SimplCore has changed types from:
>
> CoreToDo -> HscEnv -> UniqSupply -> RuleBase  -> ModGuts -> IO (SimplCount, ModGuts)
>
> to:
>
> CorePass (== CoreToDo) -> ModGuts -> CoreM ModGuts

The file to look at is CoreMonad.lhs. In particular, these functions exist:

    -- ** Reading from the monad
    getHscEnv, getAnnEnv, getRuleBase, getModule,
    getDynFlags, getOrigNameCache,

    liftIOWithCount

And it is an instance of MonadUnique so has getUniqueSupplyM. This
suggests the following implementation:

lift :: (CoreToDo -> HscEnv -> UniqSupply -> RuleBase  -> ModGuts ->
IO (SimplCount, ModGuts)) -> CorePass -> ModGuts -> CoreM ModGuts
lift f pass guts = do
  env <- getHscEnv
  us <- getUniqueSupplyM
  rb <- getRuleBase
  liftIOWithCount (f pass env us rb guts)

Disclaimer: I have not run this or even type checked it :-)

Cheers,
Max


More information about the Glasgow-haskell-users mailing list