Repository : ssh://darcs.haskell.org//srv/darcs/packages/hoopl On branch : master
http://hackage.haskell.org/trac/ghc/changeset/cf8723c8e7d83a12d6f95abffd58ccb78aa0e0cb >--------------------------------------------------------------- commit cf8723c8e7d83a12d6f95abffd58ccb78aa0e0cb Author: Norman Ramsey <[email protected]> Date: Fri Jul 22 15:20:55 2011 -0400 added and exported liftFuel method of FuelMonadT method runWithFuel remains hidden and should stay hidden thanks Justin Bailey for the bug report Signed-off-by: Norman Ramsey <[email protected]> >--------------------------------------------------------------- hoopl.cabal | 4 +++- src/Compiler/Hoopl.hs | 2 +- src/Compiler/Hoopl/Fuel.hs | 4 ++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/hoopl.cabal b/hoopl.cabal index 1991e3f..0aede00 100644 --- a/hoopl.cabal +++ b/hoopl.cabal @@ -1,7 +1,9 @@ Name: hoopl -Version: 3.8.7.1 +Version: 3.8.7.2 -- version 3.8.6.0 is the version that goes with the camera-ready Haskell'10 paper -- version 3.8.7.0 works with GHC 7 +-- version 3.8.7.1 adds some unnamed functions without breaking compatibility +-- version 3.8.7.2 adds Compiler.Hoopl.Fuel.liftFuel Description: Higher-order optimization library License: BSD3 License-file: LICENSE diff --git a/src/Compiler/Hoopl.hs b/src/Compiler/Hoopl.hs index 40f1b49..de921d6 100644 --- a/src/Compiler/Hoopl.hs +++ b/src/Compiler/Hoopl.hs @@ -22,7 +22,7 @@ import Compiler.Hoopl.Combinators import Compiler.Hoopl.Dataflow hiding ( wrapFR, wrapFR2, wrapBR, wrapBR2 ) import Compiler.Hoopl.Debug -import Compiler.Hoopl.Fuel hiding (withFuel, getFuel, setFuel, FuelMonadT) +import Compiler.Hoopl.Fuel hiding (withFuel, getFuel, setFuel, runWithFuel) import Compiler.Hoopl.Graph hiding ( Body , BCat, BHead, BTail, BClosed -- OK to expose BFirst, BMiddle, BLast diff --git a/src/Compiler/Hoopl/Fuel.hs b/src/Compiler/Hoopl/Fuel.hs index 260fd43..c9972d0 100644 --- a/src/Compiler/Hoopl/Fuel.hs +++ b/src/Compiler/Hoopl/Fuel.hs @@ -29,6 +29,8 @@ fuelRemaining = getFuel class FuelMonadT fm where runWithFuel :: (Monad m, FuelMonad (fm m)) => Fuel -> fm m a -> m a + liftFuel :: (Monad m, FuelMonad (fm m)) => m a -> fm m a + type Fuel = Int @@ -64,6 +66,7 @@ instance Monad m => FuelMonad (CheckingFuelMonad m) where instance FuelMonadT CheckingFuelMonad where runWithFuel fuel m = do { (a, _) <- unFM m fuel; return a } + liftFuel m = FM $ \f -> do { a <- m; return (a, f) } ---------------------------------------------------------------- @@ -88,6 +91,7 @@ instance CheckpointMonad m => CheckpointMonad (InfiniteFuelMonad m) where instance FuelMonadT InfiniteFuelMonad where runWithFuel _ = unIFM + liftFuel = IFM infiniteFuel :: Fuel -- effectively infinite, any, but subtractable infiniteFuel = maxBound _______________________________________________ Cvs-libraries mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-libraries
