mirror of
https://github.com/anoma/juvix.git
synced 2024-12-28 18:11:49 +03:00
a825f41507
Now the prelude exports this function: ``` readFile :: (MonadIO m) => Path Abs File -> m Text readFile = liftIO . Utf8.readFile . toFilePath ``` It is more convenient to use because it uses typed `Path` and works in any `MonadIO`.
18 lines
563 B
Haskell
18 lines
563 B
Haskell
module Commands.Dev.Asm.Run where
|
|
|
|
import AsmInterpreter
|
|
import Commands.Base
|
|
import Commands.Dev.Asm.Run.Options
|
|
import Juvix.Compiler.Asm.Translation.FromSource qualified as Asm
|
|
|
|
runCommand :: forall r. (Members '[EmbedIO, App] r) => AsmRunOptions -> Sem r ()
|
|
runCommand opts = do
|
|
afile :: Path Abs File <- fromAppPathFile file
|
|
s <- readFile afile
|
|
case Asm.runParser afile s of
|
|
Left err -> exitJuvixError (JuvixError err)
|
|
Right tab -> runAsm (not (opts ^. asmRunNoValidate)) tab
|
|
where
|
|
file :: AppPath File
|
|
file = opts ^. asmRunInputFile
|