1
0
forked from GitHub/gf-core

fixed a variable refreshing bug in the compiler

This commit is contained in:
aarne
2011-03-04 16:44:30 +00:00
parent 697e96f539
commit 8fc455f22b

View File

@@ -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