mirror of
https://github.com/anoma/juvix.git
synced 2024-12-12 14:28:08 +03:00
ce938efdcf
* Closes #2689 * Adds the command `juvix isabelle program.juvix` which translates a given file to an Isabelle/HOL theory. * Currently, only a single module is translated. * By default translates types and function signatures. Translating function signatures can be disabled with the `--only-types` option. Blocked by: - https://github.com/anoma/juvix/issues/2763 --------- Co-authored-by: Jonathan Cubides <jonathan.cubides@uib.no>
51 lines
1.7 KiB
Haskell
51 lines
1.7 KiB
Haskell
module TopCommand where
|
|
|
|
import Commands.Base hiding (Format)
|
|
import Commands.Clean qualified as Clean
|
|
import Commands.Compile qualified as Compile
|
|
import Commands.Dependencies qualified as Dependencies
|
|
import Commands.Dev qualified as Dev
|
|
import Commands.Doctor qualified as Doctor
|
|
import Commands.Eval qualified as Eval
|
|
import Commands.Format qualified as Format
|
|
import Commands.Html qualified as Html
|
|
import Commands.Init qualified as Init
|
|
import Commands.Isabelle qualified as Isabelle
|
|
import Commands.Markdown qualified as Markdown
|
|
import Commands.Repl qualified as Repl
|
|
import Commands.Typecheck qualified as Typecheck
|
|
import Juvix.Extra.Version
|
|
import System.Environment (getProgName)
|
|
import TopCommand.Options
|
|
|
|
showHelpText :: (MonadIO m) => m ()
|
|
showHelpText = do
|
|
let p = prefs showHelpOnEmpty
|
|
progn <- liftIO getProgName
|
|
let helpText = parserFailure p descr (ShowHelpText Nothing) []
|
|
(msg, _) = renderFailure helpText progn
|
|
putStrLn (pack msg)
|
|
|
|
runTopCommand ::
|
|
forall r.
|
|
(Members '[EmbedIO, App, TaggedLock] r) =>
|
|
TopCommand ->
|
|
Sem r ()
|
|
runTopCommand = \case
|
|
DisplayVersion -> runDisplayVersion
|
|
DisplayNumericVersion -> runDisplayNumericVersion
|
|
DisplayHelp -> showHelpText
|
|
Doctor opts -> runLogIO (Doctor.runCommand opts)
|
|
Isabelle opts -> Isabelle.runCommand opts
|
|
Init opts -> runLogIO (Init.init opts)
|
|
Dev opts -> Dev.runCommand opts
|
|
Typecheck opts -> Typecheck.runCommand opts
|
|
Compile opts -> Compile.runCommand opts
|
|
Clean opts -> runFilesIO (Clean.runCommand opts)
|
|
Eval opts -> Eval.runCommand opts
|
|
Html opts -> Html.runCommand opts
|
|
Markdown opts -> Markdown.runCommand opts
|
|
JuvixRepl opts -> Repl.runCommand opts
|
|
JuvixFormat opts -> runFilesIO (Format.runCommand opts)
|
|
Dependencies opts -> Dependencies.runCommand opts
|