diff --git a/bs/TagEngine.bs b/bs/TagEngine.bs index d734354..54a0c24 100644 --- a/bs/TagEngine.bs +++ b/bs/TagEngine.bs @@ -1,4 +1,6 @@ -package TagEngine(TagEngine(..), mkTagEngine) where +package TagEngine( + TagEngine(..), + mkTagEngine) where import Vector import Util @@ -31,14 +33,14 @@ initTagTail = do initTagVec :: Module(Vector numTags (Reg (Tag numTags))) initTagVec = - do - tagVecSequential :: Vector numTags (Reg (Tag numTags)) - tagVecSequential <- mapM (\idx -> initTagNext (idx+1)) genVector - let idxLast :: Integer = (fromInteger |> valueOf numTags) - 1 - tailTag <- initTagTail - -- the tail of our TagVec should be `Tail` not `Next` - let finalTagVec = update tagVecSequential idxLast tailTag - return finalTagVec + let + lastIdx :: Integer = (fromInteger |> valueOf numTags) - 1 + initByIdx currIdx = + if (currIdx < lastIdx) + then initTagNext (currIdx + 1) + else initTagTail + in + mapM initByIdx genVector mkTagEngine :: Module (TagEngine numTags) mkTagEngine = @@ -46,8 +48,6 @@ mkTagEngine = tagVec :: Vector numTags (Reg (Tag numTags)) tagVec <- initTagVec - fileHandle :: Handle <- openFile "compile.log" WriteMode - debugOnce <- mkReg True addRules $