diff options
author | Ben Sima <ben@bsima.me> | 2019-11-02 15:33:13 -0700 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2019-11-02 15:33:13 -0700 |
commit | 9d114cfc773171b0a95bd4d2c39f1bb0eb783c8d (patch) | |
tree | 20766a760ed0141cf39153565e8552f6739c632d /com/simatime/language/bs/cli.hs | |
parent | d2a37f5de160160eadbacd7b8dc2567f78a0543d (diff) |
rename everything back to caps to appease ghc
Diffstat (limited to 'com/simatime/language/bs/cli.hs')
-rw-r--r-- | com/simatime/language/bs/cli.hs | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/com/simatime/language/bs/cli.hs b/com/simatime/language/bs/cli.hs deleted file mode 100644 index 4c48c86..0000000 --- a/com/simatime/language/bs/cli.hs +++ /dev/null @@ -1,52 +0,0 @@ -{-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE NoImplicitPrelude #-} -module Language.Bs.Cli ( - run -) where - -import Data.String -import Data.Text.IO as TIO -import Language.Bs.Eval -- evalFile :: T.Text -> IO () -import Language.Bs.Repl -- Repl.mainLoop :: IO () -import Options.Applicative -import Protolude -import System.Directory - --- SOURCES ---http://book.realworldhaskell.org/read/io.html --- https://github.com/pcapriotti/optparse-applicative --- https://hackage.haskell.org/package/optparse-applicative - -runScript :: FilePath -> IO () -runScript fname = do - exists <- doesFileExist fname - if exists - then TIO.readFile fname >>= evalFile fname - else TIO.putStrLn "File does not exist." - -data LineOpts = UseReplLineOpts | RunScriptLineOpts String - -parseLineOpts :: Parser LineOpts -parseLineOpts = runScriptOpt <|> runReplOpt - where - runScriptOpt = - RunScriptLineOpts <$> strOption (long "script" - <> short 's' - <> metavar "SCRIPT" - <> help "File containing the script you want to run") - runReplOpt = - UseReplLineOpts <$ flag' () (long "repl" - <> short 'r' - <> help "Run as interavtive read/evaluate/print/loop") - -schemeEntryPoint :: LineOpts -> IO () -schemeEntryPoint UseReplLineOpts = mainLoop --repl -schemeEntryPoint (RunScriptLineOpts script) = runScript script - -run :: IO () -run = execParser opts >>= schemeEntryPoint - where - opts = info (helper <*> parseLineOpts) - ( fullDesc - <> header "Executable binary for Write You A Scheme v2.0" - <> progDesc "contains an entry point for both running scripts and repl" ) |