projects
/
matthijs
/
master-project
/
cλash.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Put a TypeState in TransformState.
[matthijs/master-project/cλash.git]
/
NormalizeTools.hs
diff --git
a/NormalizeTools.hs
b/NormalizeTools.hs
index 8e57ba8f2ec2446301ebcf22ec83e03f577470b7..1785eedc9430b675b7023a7dbf50d45f58d8bab4 100644
(file)
--- a/
NormalizeTools.hs
+++ b/
NormalizeTools.hs
@@
-119,6
+119,11
@@
subeverywhere trans (App a b) = do
b' <- trans b
return $ App a' b'
b' <- trans b
return $ App a' b'
+subeverywhere trans (Let (NonRec b bexpr) expr) = do
+ bexpr' <- trans bexpr
+ expr' <- trans expr
+ return $ Let (NonRec b bexpr') expr'
+
subeverywhere trans (Let (Rec binds) expr) = do
expr' <- trans expr
binds' <- mapM transbind binds
subeverywhere trans (Let (Rec binds) expr) = do
expr' <- trans expr
binds' <- mapM transbind binds
@@
-151,7
+156,7
@@
subeverywhere trans (Cast expr ty) = do
expr' <- trans expr
return $ Cast expr' ty
expr' <- trans expr
return $ Cast expr' ty
-subeverywhere trans expr = error $ "
NormalizeTools.subeverywhere
Unsupported expression: " ++ show expr
+subeverywhere trans expr = error $ "
\nNormalizeTools.subeverywhere:
Unsupported expression: " ++ show expr
-- Apply the given transformation to all expressions, except for direct
-- arguments of an application
-- Apply the given transformation to all expressions, except for direct
-- arguments of an application
@@
-229,5
+234,4
@@
substitute ((b, e):subss) expr = substitute subss' expr'
-- Run a given TransformSession. Used mostly to setup the right calls and
-- an initial state.
runTransformSession :: UniqSupply.UniqSupply -> TransformSession a -> a
-- Run a given TransformSession. Used mostly to setup the right calls and
-- an initial state.
runTransformSession :: UniqSupply.UniqSupply -> TransformSession a -> a
-runTransformSession uniqSupply session = State.evalState session initState
- where initState = TransformState uniqSupply Map.empty VarSet.emptyVarSet
+runTransformSession uniqSupply session = State.evalState session (emptyTransformState uniqSupply)