diff --git a/hoopl.cabal b/hoopl.cabal
--- a/hoopl.cabal
+++ b/hoopl.cabal
@@ -1,10 +1,12 @@
 Name:                hoopl
-Version:             3.8.7.1
+Version:             3.8.7.3
 -- 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
+License-File:        LICENSE
 Author:              Norman Ramsey, João Dias, and Simon Peyton Jones
 Maintainer:          nr@cs.tufts.edu
 Homepage:            http://ghc.cs.tufts.edu/hoopl/
@@ -13,38 +15,39 @@
 Stability:           alpha
 Synopsis:            A library to support dataflow analysis and optimization
 Category:            Compilers/Interpreters
-Extra-source-files:  README, hoopl.pdf, CHANGES, FAQ
+Extra-Source-Files:  README, hoopl.pdf, CHANGES, FAQ
 
 Library
+  Hs-Source-Dirs:    src
   Build-Depends:     base >= 3 && < 5, containers
-  Exposed-modules:   Compiler.Hoopl,
+  Exposed-Modules:   Compiler.Hoopl,
                      Compiler.Hoopl.Wrappers,
                      Compiler.Hoopl.Passes.Dominator,
                      Compiler.Hoopl.Passes.DList,
---                       Compiler.Hoopl.DataflowFold,
---                       Compiler.Hoopl.OldDataflow,
-                       Compiler.Hoopl.GHC
-  Other-modules:     Compiler.Hoopl.GraphUtil,
+--                     Compiler.Hoopl.DataflowFold,
+--                     Compiler.Hoopl.OldDataflow,
+                     Compiler.Hoopl.GHC
+  Other-Modules:     Compiler.Hoopl.GraphUtil,
                      -- GraphUtil should *never* be seen by clients.
                      -- The remaining modules are hidden *provisionally*
-                       Compiler.Hoopl.Checkpoint,
-                       Compiler.Hoopl.Collections,
-                       Compiler.Hoopl.Combinators,
-                       Compiler.Hoopl.Dataflow,
-                       Compiler.Hoopl.Debug,
-                       Compiler.Hoopl.Graph, 
-                       Compiler.Hoopl.Label,
-                       Compiler.Hoopl.MkGraph,
-                       Compiler.Hoopl.Fuel,
-                       Compiler.Hoopl.Pointed,
-                       Compiler.Hoopl.Shape,
-                       Compiler.Hoopl.Show, 
-                       Compiler.Hoopl.Unique, 
-                       Compiler.Hoopl.Util
-                       Compiler.Hoopl.XUtil
-  ghc-options:       -Wall -fno-warn-name-shadowing
-  hs-source-dirs:  src
+                     Compiler.Hoopl.Checkpoint,
+                     Compiler.Hoopl.Collections,
+                     Compiler.Hoopl.Combinators,
+                     Compiler.Hoopl.Dataflow,
+                     Compiler.Hoopl.Debug,
+                     Compiler.Hoopl.Graph, 
+                     Compiler.Hoopl.Label,
+                     Compiler.Hoopl.MkGraph,
+                     Compiler.Hoopl.Fuel,
+                     Compiler.Hoopl.Pointed,
+                     Compiler.Hoopl.Shape,
+                     Compiler.Hoopl.Show, 
+                     Compiler.Hoopl.Unique, 
+                     Compiler.Hoopl.Util,
+                     Compiler.Hoopl.XUtil
 
+  Ghc-Options:       -Wall -fno-warn-name-shadowing
+  Extensions:        CPP
 
 Source-repository head
   Type:       git
diff --git a/src/Compiler/Hoopl.hs b/src/Compiler/Hoopl.hs
--- a/src/Compiler/Hoopl.hs
+++ b/src/Compiler/Hoopl.hs
@@ -1,3 +1,7 @@
+#if __GLASGOW_HASKELL__ >= 701
+{-# LANGUAGE Safe #-}
+#endif
+
 module Compiler.Hoopl
   ( module Compiler.Hoopl.Graph
   , module Compiler.Hoopl.MkGraph
@@ -22,7 +26,7 @@
 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/Checkpoint.hs b/src/Compiler/Hoopl/Checkpoint.hs
--- a/src/Compiler/Hoopl/Checkpoint.hs
+++ b/src/Compiler/Hoopl/Checkpoint.hs
@@ -1,4 +1,7 @@
 {-# LANGUAGE TypeFamilies #-}
+#if __GLASGOW_HASKELL__ >= 701
+{-# LANGUAGE Safe #-}
+#endif
 
 module Compiler.Hoopl.Checkpoint
   ( CheckpointMonad(..)
diff --git a/src/Compiler/Hoopl/Collections.hs b/src/Compiler/Hoopl/Collections.hs
--- a/src/Compiler/Hoopl/Collections.hs
+++ b/src/Compiler/Hoopl/Collections.hs
@@ -1,6 +1,10 @@
 {- Baseclasses for Map-like and Set-like collections inspired by containers. -}
 
 {-# LANGUAGE TypeFamilies #-}
+#if __GLASGOW_HASKELL__ >= 701
+{-# LANGUAGE Safe #-}
+#endif
+
 module Compiler.Hoopl.Collections ( IsSet(..)
                                   , setInsertList, setDeleteList, setUnions
                                   , IsMap(..)
diff --git a/src/Compiler/Hoopl/Combinators.hs b/src/Compiler/Hoopl/Combinators.hs
--- a/src/Compiler/Hoopl/Combinators.hs
+++ b/src/Compiler/Hoopl/Combinators.hs
@@ -1,4 +1,7 @@
 {-# LANGUAGE RankNTypes, LiberalTypeSynonyms, ScopedTypeVariables, GADTs #-}
+#if __GLASGOW_HASKELL__ >= 701
+{-# LANGUAGE Safe #-}
+#endif
 
 module Compiler.Hoopl.Combinators
   ( thenFwdRw
diff --git a/src/Compiler/Hoopl/Dataflow.hs b/src/Compiler/Hoopl/Dataflow.hs
--- a/src/Compiler/Hoopl/Dataflow.hs
+++ b/src/Compiler/Hoopl/Dataflow.hs
@@ -1,4 +1,7 @@
 {-# LANGUAGE RankNTypes, ScopedTypeVariables, GADTs, EmptyDataDecls, PatternGuards, TypeFamilies, MultiParamTypeClasses #-}
+#if __GLASGOW_HASKELL__ >= 701
+{-# LANGUAGE Safe #-}
+#endif
 
 module Compiler.Hoopl.Dataflow
   ( DataflowLattice(..), JoinFun, OldFact(..), NewFact(..), Fact, mkFactBase
@@ -590,7 +593,7 @@
       | otherwise
       = do { (rg, out_facts) <- do_block blk fbase
            ; let (cha', fbase') = mapFoldWithKey
-                                  (updateFact lat lbls) 
+                                  (updateFact lat lbls')
                                   (cha,fbase) out_facts
            ; return $
                TxFB { tfb_lbls  = lbls'
diff --git a/src/Compiler/Hoopl/Debug.hs b/src/Compiler/Hoopl/Debug.hs
--- a/src/Compiler/Hoopl/Debug.hs
+++ b/src/Compiler/Hoopl/Debug.hs
@@ -1,4 +1,7 @@
 {-# LANGUAGE RankNTypes, GADTs, ScopedTypeVariables, FlexibleContexts #-}
+#if __GLASGOW_HASKELL__ >= 701
+{-# LANGUAGE Safe #-}
+#endif
 
 module Compiler.Hoopl.Debug 
   ( TraceFn , debugFwdJoins , debugBwdJoins
diff --git a/src/Compiler/Hoopl/Fuel.hs b/src/Compiler/Hoopl/Fuel.hs
--- a/src/Compiler/Hoopl/Fuel.hs
+++ b/src/Compiler/Hoopl/Fuel.hs
@@ -1,4 +1,7 @@
 {-# LANGUAGE TypeFamilies #-}
+#if __GLASGOW_HASKELL__ >= 701
+{-# LANGUAGE Safe #-}
+#endif
 
 -----------------------------------------------------------------------------
 --		The fuel monad
@@ -29,8 +32,10 @@
 
 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
 
 withFuel :: FuelMonad m => Maybe a -> m (Maybe a)
@@ -64,6 +69,7 @@
 
 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 +94,7 @@
 
 instance FuelMonadT InfiniteFuelMonad where
   runWithFuel _ = unIFM
+  liftFuel = IFM
 
 infiniteFuel :: Fuel -- effectively infinite, any, but subtractable
 infiniteFuel = maxBound
diff --git a/src/Compiler/Hoopl/GHC.hs b/src/Compiler/Hoopl/GHC.hs
--- a/src/Compiler/Hoopl/GHC.hs
+++ b/src/Compiler/Hoopl/GHC.hs
@@ -1,4 +1,7 @@
 {-# LANGUAGE GADTs, RankNTypes #-}
+#if __GLASGOW_HASKELL__ >= 701
+{-# LANGUAGE Safe #-}
+#endif
 
 {- Exposing some internals to GHC -}
 module Compiler.Hoopl.GHC
diff --git a/src/Compiler/Hoopl/Graph.hs b/src/Compiler/Hoopl/Graph.hs
--- a/src/Compiler/Hoopl/Graph.hs
+++ b/src/Compiler/Hoopl/Graph.hs
@@ -1,10 +1,14 @@
-{-# LANGUAGE GADTs, EmptyDataDecls, TypeFamilies #-}
+{-# LANGUAGE GADTs, EmptyDataDecls, TypeFamilies, Rank2Types #-}
+#if __GLASGOW_HASKELL__ >= 701
+{-# LANGUAGE Safe #-}
+#endif
 
 module Compiler.Hoopl.Graph 
   ( O, C, Block(..), Body, Body'(..), Graph, Graph'(..)
   , MaybeO(..), MaybeC(..), Shape(..), IndexedCO
   , NonLocal(entryLabel, successors)
   , emptyBody, addBlock, bodyList
+  , mapGraph, mapMaybeO, mapMaybeC, mapBlock
   )
 where
 
@@ -53,7 +57,7 @@
 -- A graph open at the entry has a single, distinguished, anonymous entry point;
 -- if a graph is closed at the entry, its entry point(s) are supplied by a context.
 type Graph = Graph' Block
-data Graph' block n e x where
+data Graph' block (n :: * -> * -> *) e x where
   GNil  :: Graph' block n O O
   GUnit :: block n O O -> Graph' block n O O
   GMany :: MaybeO e (block n O C) 
@@ -117,3 +121,29 @@
 
 bodyList :: NonLocal (block n) => Body' block n -> [(Label,block n C C)]
 bodyList (Body body) = mapToList body
+
+-- | Maps over all nodes in a graph.
+mapGraph :: (forall e x. n e x -> n' e x) -> Graph n e x -> Graph n' e x
+mapGraph _ GNil = GNil
+mapGraph f (GUnit b) = GUnit (mapBlock f b)
+mapGraph f (GMany x y z)
+    = GMany (mapMaybeO f x)
+            (mapMap (mapBlock f) y)
+            (mapMaybeO f z)
+
+mapMaybeO :: (forall e x. n e x -> n' e x) -> MaybeO ex (Block n e x) -> MaybeO ex (Block n' e x)
+mapMaybeO _  NothingO = NothingO
+mapMaybeO f (JustO b) = JustO (mapBlock f b)
+
+mapMaybeC :: (forall e x. n e x -> n' e x) -> MaybeC ex (Block n e x) -> MaybeC ex (Block n' e x)
+mapMaybeC _  NothingC = NothingC
+mapMaybeC f (JustC b) = JustC (mapBlock f b)
+
+mapBlock :: (forall e x. n e x -> n' e x) -> Block n e x -> Block n' e x
+mapBlock f (BFirst n)      = BFirst  (f n)
+mapBlock f (BMiddle n)     = BMiddle (f n)
+mapBlock f (BLast n)       = BLast   (f n)
+mapBlock f (BCat b1 b2)    = BCat    (mapBlock f b1) (mapBlock f b2)
+mapBlock f (BHead b n)     = BHead   (mapBlock f b)  (f n)
+mapBlock f (BTail n b)     = BTail   (f n)  (mapBlock f b)
+mapBlock f (BClosed b1 b2) = BClosed (mapBlock f b1) (mapBlock f b2)
diff --git a/src/Compiler/Hoopl/GraphUtil.hs b/src/Compiler/Hoopl/GraphUtil.hs
--- a/src/Compiler/Hoopl/GraphUtil.hs
+++ b/src/Compiler/Hoopl/GraphUtil.hs
@@ -1,4 +1,7 @@
 {-# LANGUAGE GADTs, RankNTypes, ScopedTypeVariables #-}
+#if __GLASGOW_HASKELL__ >= 701
+{-# LANGUAGE Safe #-}
+#endif
 
 -- N.B. addBasicBlocks won't work on OO without a Node (branch/label) constraint
 
diff --git a/src/Compiler/Hoopl/Label.hs b/src/Compiler/Hoopl/Label.hs
--- a/src/Compiler/Hoopl/Label.hs
+++ b/src/Compiler/Hoopl/Label.hs
@@ -1,4 +1,8 @@
 {-# LANGUAGE TypeFamilies #-}
+#if __GLASGOW_HASKELL__ >= 701
+{-# LANGUAGE Safe #-}
+#endif
+
 module Compiler.Hoopl.Label
   ( Label
   , freshLabel
diff --git a/src/Compiler/Hoopl/MkGraph.hs b/src/Compiler/Hoopl/MkGraph.hs
--- a/src/Compiler/Hoopl/MkGraph.hs
+++ b/src/Compiler/Hoopl/MkGraph.hs
@@ -1,4 +1,8 @@
 {-# LANGUAGE ScopedTypeVariables, GADTs, TypeSynonymInstances, FlexibleInstances, RankNTypes #-}
+#if __GLASGOW_HASKELL__ >= 701
+{-# LANGUAGE Safe #-}
+#endif
+
 module Compiler.Hoopl.MkGraph
     ( AGraph, graphOfAGraph, aGraphOfGraph
     , (<*>), (|*><*|), catGraphs, addEntrySeq, addExitSeq, addBlocks, unionBlocks
diff --git a/src/Compiler/Hoopl/Passes/DList.hs b/src/Compiler/Hoopl/Passes/DList.hs
--- a/src/Compiler/Hoopl/Passes/DList.hs
+++ b/src/Compiler/Hoopl/Passes/DList.hs
@@ -1,5 +1,8 @@
 {-# LANGUAGE GADTs #-}
 {-# OPTIONS_GHC -Wall -fno-warn-name-shadowing #-}
+#if __GLASGOW_HASKELL__ >= 701
+{-# LANGUAGE Safe #-}
+#endif
 
 module Compiler.Hoopl.Passes.DList
   ( Doms, domEntry, domLattice
diff --git a/src/Compiler/Hoopl/Passes/Dominator.hs b/src/Compiler/Hoopl/Passes/Dominator.hs
--- a/src/Compiler/Hoopl/Passes/Dominator.hs
+++ b/src/Compiler/Hoopl/Passes/Dominator.hs
@@ -1,5 +1,8 @@
 {-# LANGUAGE GADTs #-}
 {-# OPTIONS_GHC -Wall -fno-warn-name-shadowing #-}
+#if __GLASGOW_HASKELL__ >= 701
+{-# LANGUAGE Safe #-}
+#endif
 
 module Compiler.Hoopl.Passes.Dominator
   ( Doms, DPath(..), domPath, domEntry, domLattice, extendDom
diff --git a/src/Compiler/Hoopl/Pointed.hs b/src/Compiler/Hoopl/Pointed.hs
--- a/src/Compiler/Hoopl/Pointed.hs
+++ b/src/Compiler/Hoopl/Pointed.hs
@@ -1,4 +1,7 @@
 {-# LANGUAGE GADTs, ScopedTypeVariables #-}
+#if __GLASGOW_HASKELL__ >= 701
+{-# LANGUAGE Safe #-}
+#endif
 
 -- | Possibly doubly pointed lattices
 
diff --git a/src/Compiler/Hoopl/Shape.hs b/src/Compiler/Hoopl/Shape.hs
--- a/src/Compiler/Hoopl/Shape.hs
+++ b/src/Compiler/Hoopl/Shape.hs
@@ -1,4 +1,7 @@
 {-# LANGUAGE GADTs, EmptyDataDecls #-}
+#if __GLASGOW_HASKELL__ >= 701
+{-# LANGUAGE Safe #-}
+#endif
 
 module Compiler.Hoopl.Shape {-# DEPRECATED "not ready to migrate to this yet" #-}
 where
diff --git a/src/Compiler/Hoopl/Show.hs b/src/Compiler/Hoopl/Show.hs
--- a/src/Compiler/Hoopl/Show.hs
+++ b/src/Compiler/Hoopl/Show.hs
@@ -1,4 +1,7 @@
 {-# LANGUAGE RankNTypes, GADTs, ScopedTypeVariables, FlexibleContexts #-}
+#if __GLASGOW_HASKELL__ >= 701
+{-# LANGUAGE Safe #-}
+#endif
 
 module Compiler.Hoopl.Show 
   ( showGraph, showFactBase
diff --git a/src/Compiler/Hoopl/Unique.hs b/src/Compiler/Hoopl/Unique.hs
--- a/src/Compiler/Hoopl/Unique.hs
+++ b/src/Compiler/Hoopl/Unique.hs
@@ -1,4 +1,8 @@
 {-# LANGUAGE TypeFamilies #-}
+#if __GLASGOW_HASKELL__ >= 701
+{-# LANGUAGE Trustworthy #-}
+#endif
+
 module Compiler.Hoopl.Unique
   ( Unique, intToUnique
   , UniqueSet, UniqueMap
diff --git a/src/Compiler/Hoopl/Util.hs b/src/Compiler/Hoopl/Util.hs
--- a/src/Compiler/Hoopl/Util.hs
+++ b/src/Compiler/Hoopl/Util.hs
@@ -1,4 +1,7 @@
 {-# LANGUAGE GADTs, ScopedTypeVariables, FlexibleInstances, RankNTypes, TypeFamilies #-}
+#if __GLASGOW_HASKELL__ >= 701
+{-# LANGUAGE Safe #-}
+#endif
 
 module Compiler.Hoopl.Util
   ( gUnitOO, gUnitOC, gUnitCO, gUnitCC
diff --git a/src/Compiler/Hoopl/Wrappers.hs b/src/Compiler/Hoopl/Wrappers.hs
--- a/src/Compiler/Hoopl/Wrappers.hs
+++ b/src/Compiler/Hoopl/Wrappers.hs
@@ -1,3 +1,7 @@
+#if __GLASGOW_HASKELL__ >= 701
+{-# LANGUAGE Safe #-}
+#endif
+
 module Compiler.Hoopl.Wrappers {-# DEPRECATED "Use only if you know what you are doing and can preserve the 'respects fuel' invariant" #-}
   ( wrapFR, wrapFR2, wrapBR, wrapBR2
   )
diff --git a/src/Compiler/Hoopl/XUtil.hs b/src/Compiler/Hoopl/XUtil.hs
--- a/src/Compiler/Hoopl/XUtil.hs
+++ b/src/Compiler/Hoopl/XUtil.hs
@@ -1,4 +1,7 @@
 {-# LANGUAGE GADTs, RankNTypes, ScopedTypeVariables, TypeFamilies  #-}
+#if __GLASGOW_HASKELL__ >= 701
+{-# LANGUAGE Trustworthy #-}
+#endif
 
 -- | Utilities for clients of Hoopl, not used internally.
 
