Commit 1ebefd3d authored by Simon Marlow's avatar Simon Marlow
Browse files

remove unused code

parent 00c3616c
...@@ -8,10 +8,8 @@ ...@@ -8,10 +8,8 @@
module OptimizationFuel module OptimizationFuel
( OptimizationFuel, amountOfFuel, tankFilledTo, unlimitedFuel, anyFuelLeft, oneLessFuel ( OptimizationFuel, amountOfFuel, tankFilledTo, unlimitedFuel, anyFuelLeft, oneLessFuel
, OptFuelState, initOptFuelState , OptFuelState, initOptFuelState
, FuelConsumer, FuelUsingMonad, FuelState , FuelConsumer, FuelState
, fuelGet, fuelSet, lastFuelPass, setFuelPass , runFuelIO, runInfiniteFuelIO
, fuelExhausted, fuelDec1, tryWithFuel
, runFuelIO, runInfiniteFuelIO, fuelConsumingPass
, FuelUniqSM , FuelUniqSM
, liftUniq , liftUniq
) )
...@@ -65,13 +63,6 @@ data FuelState = FuelState { fs_fuel :: {-# UNPACK #-} !OptimizationFuel, ...@@ -65,13 +63,6 @@ data FuelState = FuelState { fs_fuel :: {-# UNPACK #-} !OptimizationFuel,
fs_lastpass :: String } fs_lastpass :: String }
newtype FuelUniqSM a = FUSM { unFUSM :: UniqSupply -> FuelState -> (# a, UniqSupply, FuelState #) } newtype FuelUniqSM a = FUSM { unFUSM :: UniqSupply -> FuelState -> (# a, UniqSupply, FuelState #) }
fuelConsumingPass :: String -> FuelConsumer a -> FuelUniqSM a
fuelConsumingPass name f = do setFuelPass name
fuel <- fuelGet
let (a, fuel') = f fuel
fuelSet fuel'
return a
runFuelIO :: OptFuelState -> FuelUniqSM a -> IO a runFuelIO :: OptFuelState -> FuelUniqSM a -> IO a
runFuelIO fs (FUSM f) = runFuelIO fs (FUSM f) =
do pass <- readIORef (pass_ref fs) do pass <- readIORef (pass_ref fs)
...@@ -90,7 +81,7 @@ runInfiniteFuelIO fs (FUSM f) = ...@@ -90,7 +81,7 @@ runInfiniteFuelIO fs (FUSM f) =
do pass <- readIORef (pass_ref fs) do pass <- readIORef (pass_ref fs)
u <- mkSplitUniqSupply 'u' u <- mkSplitUniqSupply 'u'
case f u (FuelState unlimitedFuel pass) of case f u (FuelState unlimitedFuel pass) of
(# a, _, FuelState fuel' pass' #) -> do (# a, _, FuelState _fuel pass' #) -> do
writeIORef (pass_ref fs) pass' writeIORef (pass_ref fs) pass'
return a return a
...@@ -122,17 +113,6 @@ class Monad m => FuelUsingMonad m where ...@@ -122,17 +113,6 @@ class Monad m => FuelUsingMonad m where
lastFuelPass :: m String lastFuelPass :: m String
setFuelPass :: String -> m () setFuelPass :: String -> m ()
fuelExhausted :: FuelUsingMonad m => m Bool
fuelExhausted = fuelGet >>= return . anyFuelLeft
fuelDec1 :: FuelUsingMonad m => m ()
fuelDec1 = fuelGet >>= fuelSet . oneLessFuel
tryWithFuel :: FuelUsingMonad m => a -> m (Maybe a)
tryWithFuel r = do f <- fuelGet
if anyFuelLeft f then fuelSet (oneLessFuel f) >> return (Just r)
else return Nothing
instance FuelUsingMonad FuelUniqSM where instance FuelUsingMonad FuelUniqSM where
fuelGet = extract fs_fuel fuelGet = extract fs_fuel
lastFuelPass = extract fs_lastpass lastFuelPass = extract fs_lastpass
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment