module DDC.Driver.Command.Flow.Prep
(cmdFlowPrep)
where
import DDC.Driver.Stage
import DDC.Interface.Source
import DDC.Build.Pipeline
import Control.Monad.Trans.Error
import Control.Monad.IO.Class
import qualified DDC.Base.Pretty as P
import qualified DDC.Build.Language.Flow as Flow
cmdFlowPrep
:: Config
-> Source
-> String
-> ErrorT String IO ()
cmdFlowPrep config source sourceText
= do
errs <- liftIO
$ pipeText (nameOfSource source)
(lineStartOfSource source)
sourceText
$ stageFlowLoad config source
[ stageFlowPrep config source
[ PipeCoreCheck Flow.fragment
[ PipeCoreOutput SinkStdout ]]]
case errs of
[] -> return ()
es -> throwError $ P.renderIndent $ P.vcat $ map P.ppr es