summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoraarne <aarne@chalmers.se>2011-03-04 16:44:30 +0000
committeraarne <aarne@chalmers.se>2011-03-04 16:44:30 +0000
commit88a0790f322789c1851d38e0c80fc5e1b37bf24e (patch)
tree348ce5e729c3e9e21196a3c21e61f22f82706ad9 /src
parent914ee3339681ef7defe880b821128cf14df0b126 (diff)
fixed a variable refreshing bug in the compiler
Diffstat (limited to 'src')
-rw-r--r--src/compiler/GF/Compile/Refresh.hs13
1 files changed, 13 insertions, 0 deletions
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
+
+