module FST.Info where
import FST.TransducerInterface
data Info = Info {
transducer :: (Transducer String, Bool),
expression :: (RReg String, Bool),
input :: ([String], Bool),
outputs :: ([String], Bool)
} deriving (Show)
emptyInfo :: Info
emptyInfo = Info {
transducer = (emptyTransducer, False),
expression = (empty, False),
input = ([], False),
outputs = ([], False)
}
transducerBuilt :: Info -> Bool
transducerBuilt = snd . transducer
expressionRead :: Info -> Bool
expressionRead = snd . expression
inputRead :: Info -> Bool
inputRead = snd . input
outputsRead :: Info -> Bool
outputsRead = snd . outputs
updateTransducer :: Transducer String -> Info -> Info
updateTransducer t info = info { transducer = (t, True) }
updateExpression :: RReg String -> Info -> Info
updateExpression r info = info { expression = (r, True) }
updateInput :: [String] -> Info -> Info
updateInput inp info = info { input = (inp, True) }
updateOutputs :: [String] -> Info -> Info
updateOutputs out info = info { outputs = (out, True) }
getTransducer :: Info -> Transducer String
getTransducer = fst . transducer
getExpression :: Info -> RReg String
getExpression = fst . expression
getInput :: Info -> [String]
getInput = fst . input
getOutputs :: Info -> [String]
getOutputs = fst . outputs