diff options
author | Ben Sima <ben@bsima.me> | 2020-04-15 15:24:32 -0700 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2020-04-15 17:19:43 -0700 |
commit | e9a53b69ad68e531a789eff3128f7304fd411808 (patch) | |
tree | 7c0382cb3c49458e8c989eaaa042bc37b37a9699 /Biz/Language/Bs/Cli.hs | |
parent | cb77d0eb623c7a398ca86a632d0ea37ac385cc3d (diff) |
Lint fixes, also delete Biz.Language
Diffstat (limited to 'Biz/Language/Bs/Cli.hs')
-rw-r--r-- | Biz/Language/Bs/Cli.hs | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/Biz/Language/Bs/Cli.hs b/Biz/Language/Bs/Cli.hs deleted file mode 100644 index d2ac1e4..0000000 --- a/Biz/Language/Bs/Cli.hs +++ /dev/null @@ -1,64 +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" - ) |