1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-14 08:27:03 +03:00
juvix/app/Main.hs
Paul Cadman df4036d600
Compute new entrypoint root when loading a file in the REPL (#1615)
* Add shelltests for `juvix repl`

* repl: Compute entrypoint root when loading a file

Previously the REPL would use app root (which could be the current
directory or the project root of the initially loaded file). Thus files
in a different project could not be loaded.

The entrypoint root must be computed each time a new file is `:load`ed.

Adds shell-tests for REPL commands

* Move preludePath to Juvix.Extra.Paths
2022-11-10 11:26:38 +00:00

19 lines
473 B
Haskell

module Main (main) where
import App
import CommonOptions
import Juvix.Compiler.Pipeline
import Root
import TopCommand
import TopCommand.Options
main :: IO ()
main = do
let p = prefs showHelpOnEmpty
(global, cli) <- customExecParser p descr >>= secondM makeAbsPaths
(root, pkg) <- findRoot' cli
runM (runAppIO global root pkg (runTopCommand cli))
where
findRoot' :: TopCommand -> IO (FilePath, Package)
findRoot' cli = findRoot (topCommandInputFile cli)