diff --git a/src/compiler/GF/Compile/Refresh.hs b/src/compiler/GF/Compile/Refresh.hs index a05e87e5c..159c26a38 100644 --- a/src/compiler/GF/Compile/Refresh.hs +++ b/src/compiler/GF/Compile/Refresh.hs @@ -60,6 +60,8 @@ refresh e = case e of T i cc -> liftM2 T (refreshTInfo i) (mapM refreshCase cc) + App f a -> liftM2 App (inBlockSTM (refresh f)) (refresh a) + _ -> composOp refresh e refreshCase :: (Patt,Term) -> STM IdState (Patt,Term) @@ -131,3 +133,14 @@ refreshModule (k,ms) mi@(i,mo) return $ (k', (c, CncFun mt (Just (L loc trm')) pn):cs) _ -> return (k, ci:cs) + +-- running monad and returning to initial state + +inBlockSTM :: STM s a -> STM s a +inBlockSTM mo = do + s <- readSTM + v <- mo + writeSTM s + return v + +