Permalink
Browse files

Improve tagging of terms to eliminate duplicate tags in the input

  • Loading branch information...
1 parent c8a3251 commit ddf4eed6f0a84b8ab642be6806836988a565e777 @batterseapower committed Jul 19, 2010
Showing with 6 additions and 3 deletions.
  1. +6 −3 Core/Syntax.hs
View
@@ -144,11 +144,14 @@ tagTerm ids (Term e) = TaggedTerm $ Tagged (hashedId i) $ case e of
Value v -> Value (tagValue ids' v)
App e x -> App (tagTerm ids' e) x
PrimOp pop es -> PrimOp pop (zipWith tagTerm idss' es)
- Case e alts -> Case (tagTerm ids' e) (tagAlts (head idss') alts)
- LetRec xes e -> LetRec (zipWith (\ids'' (x, e) -> (x, tagTerm ids'' e)) idss' xes) (tagTerm ids' e)
+ where idss' = splitIdSupplyL ids
+ Case e alts -> Case (tagTerm ids0' e) (tagAlts ids1' alts)
+ where (ids0', ids1') = splitIdSupply ids'
+ LetRec xes e -> LetRec (zipWith (\ids'' (x, e) -> (x, tagTerm ids'' e)) idss' xes) (tagTerm ids1' e)
+ where (ids0', ids1') = splitIdSupply ids'
+ idss' = splitIdSupplyL ids0'
where
(ids', i) = stepIdSupply ids
- idss' = splitIdSupplyL ids'
tagValue :: IdSupply -> Value -> TaggedValue
tagValue ids v = case v of

0 comments on commit ddf4eed

Please sign in to comment.