
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 and it isn't easy for me to figure out the relationship between the two types. Is there some sort of formula I can follow to convert a function with the first type to the second? -- Colin Adams Preston Lancashire

2009/4/1 Colin Paul Adams
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
participants (2)
-
Colin Paul Adams
-
Max Bolingbroke