ghc-7.4.2: The GHC API

Safe Haskell | None

OptimizationFuel

Description

Optimisation fuel is used to control the amount of work the optimiser does.

Every optimisation step consumes a certain amount of fuel and stops when it runs out of fuel. This can be used e.g. to debug optimiser bugs: Run the optimiser with varying amount of fuel to find out the exact number of steps where a bug is introduced in the output.

# Documentation

data OptimizationFuel

Instances

Show OptimizationFuel |

amountOfFuel :: OptimizationFuel -> Int

tankFilledTo :: Int -> OptimizationFuel

unlimitedFuel :: OptimizationFuel

anyFuelLeft :: OptimizationFuel -> Bool

oneLessFuel :: OptimizationFuel -> OptimizationFuel

data OptFuelState

initOptFuelState :: IO OptFuelState

type FuelConsumer a = OptimizationFuel -> (a, OptimizationFuel)

class Monad m => FuelUsingMonad m where

Methods

fuelGet :: m OptimizationFuel

fuelSet :: OptimizationFuel -> m ()

lastFuelPass :: m String

setFuelPass :: String -> m ()

Instances

FuelUsingMonad FuelUniqSM |

data FuelState

fuelExhausted :: FuelUsingMonad m => m Bool

fuelDec1 :: FuelUsingMonad m => m ()

tryWithFuel :: FuelUsingMonad m => a -> m (Maybe a)

runFuelIO :: OptFuelState -> FuelUniqSM a -> IO a

runInfiniteFuelIO :: OptFuelState -> FuelUniqSM a -> IO a

fuelConsumingPass :: String -> FuelConsumer a -> FuelUniqSM a

data FuelUniqSM a

Instances

Monad FuelUniqSM |
FuelMonad FuelUniqSM |
CheckpointMonad FuelUniqSM |
MonadUnique FuelUniqSM |
FuelUsingMonad FuelUniqSM |

liftUniq :: UniqSM x -> FuelUniqSM x