refactor a bit
This commit is contained in:
parent
5f2d9456ae
commit
7ad812d3da
|
@ -1,4 +1,6 @@
|
||||||
package TagEngine(TagEngine(..), mkTagEngine) where
|
package TagEngine(
|
||||||
|
TagEngine(..),
|
||||||
|
mkTagEngine) where
|
||||||
|
|
||||||
import Vector
|
import Vector
|
||||||
import Util
|
import Util
|
||||||
|
@ -31,14 +33,14 @@ initTagTail = do
|
||||||
|
|
||||||
initTagVec :: Module(Vector numTags (Reg (Tag numTags)))
|
initTagVec :: Module(Vector numTags (Reg (Tag numTags)))
|
||||||
initTagVec =
|
initTagVec =
|
||||||
do
|
let
|
||||||
tagVecSequential :: Vector numTags (Reg (Tag numTags))
|
lastIdx :: Integer = (fromInteger |> valueOf numTags) - 1
|
||||||
tagVecSequential <- mapM (\idx -> initTagNext (idx+1)) genVector
|
initByIdx currIdx =
|
||||||
let idxLast :: Integer = (fromInteger |> valueOf numTags) - 1
|
if (currIdx < lastIdx)
|
||||||
tailTag <- initTagTail
|
then initTagNext (currIdx + 1)
|
||||||
-- the tail of our TagVec should be `Tail` not `Next`
|
else initTagTail
|
||||||
let finalTagVec = update tagVecSequential idxLast tailTag
|
in
|
||||||
return finalTagVec
|
mapM initByIdx genVector
|
||||||
|
|
||||||
mkTagEngine :: Module (TagEngine numTags)
|
mkTagEngine :: Module (TagEngine numTags)
|
||||||
mkTagEngine =
|
mkTagEngine =
|
||||||
|
@ -46,8 +48,6 @@ mkTagEngine =
|
||||||
tagVec :: Vector numTags (Reg (Tag numTags))
|
tagVec :: Vector numTags (Reg (Tag numTags))
|
||||||
tagVec <- initTagVec
|
tagVec <- initTagVec
|
||||||
|
|
||||||
fileHandle :: Handle <- openFile "compile.log" WriteMode
|
|
||||||
|
|
||||||
debugOnce <- mkReg True
|
debugOnce <- mkReg True
|
||||||
|
|
||||||
addRules $
|
addRules $
|
||||||
|
|
Loading…
Reference in a new issue