moduleDDC.Driver.Command.ToC(cmdToC)whereimportDDC.Driver.StageimportDDC.Driver.SourceimportDDC.Build.PipelineimportDDC.Build.LanguageimportDDC.Core.FragmentimportSystem.FilePathimportControl.Monad.Trans.ErrorimportControl.Monad.IO.ClassimportqualifiedDDC.Build.Language.SaltasSaltimportqualifiedDDC.Build.Language.LiteasLiteimportqualifiedDDC.Base.PrettyasP-- | Parse, check, and convert a module to C.---- The output is printed to @stdout@. --cmdToC::Config-- ^ Compiler configuration.->Language-- ^ Language definition.->Source-- ^ Source of the code.->String-- ^ Program module text.->ErrorTStringIO()cmdToCconfiglanguagesourcesourceText|Languagebundle<-language,fragment<-bundleFragmentbundle,profile<-fragmentProfilefragment=doletfragName=profileNameprofileletmSuffix=casesourceofSourceFilefilePath->Just$takeExtensionfilePath_->Nothing-- Decide what to do based on file extension and current fragment.letcompile-- Compile a Core Lite module.|fragName=="Lite"||mSuffix==Just".dcl"=liftIO$pipeText(nameOfSourcesource)(lineStartOfSourcesource)sourceText$PipeTextLoadCoreLite.fragment[PipeCoreStrip[stageLiteOptconfigsource[stageLiteToSaltconfigsource[stageSaltOptconfigsource[stageSaltToCconfigsourceSinkStdout]]]]]-- Compile a Core Salt module.|fragName=="Salt"||mSuffix==Just".dcs"=liftIO$pipeText(nameOfSourcesource)(lineStartOfSourcesource)sourceText$PipeTextLoadCoreSalt.fragment[PipeCoreStrip[stageSaltOptconfigsource[stageSaltToCconfigsourceSinkStdout]]]-- Unrecognised.|otherwise=throwError"Don't know how to convert this to C"-- Throw any errors that arose during compilationerrs<-compilecaseerrsof[]->return()es->throwError$P.renderIndent$P.vcat$mapP.ppres