From 88a0790f322789c1851d38e0c80fc5e1b37bf24e Mon Sep 17 00:00:00 2001 From: aarne Date: Fri, 4 Mar 2011 16:44:30 +0000 Subject: [PATCH] fixed a variable refreshing bug in the compiler --- src/compiler/GF/Compile/Refresh.hs | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 + +