diff options
author | Ben Sima <ben@bsima.me> | 2020-04-15 10:06:24 -0700 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2020-04-15 10:07:02 -0700 |
commit | afa9d701538b9e56622a0bfdf8e04aa358c9cd82 (patch) | |
tree | dee95c3955b3fe3d11e80d89823660d28eee0587 /Biz/Language/Bs/Cli.hs | |
parent | f4b8c0df041b063c0b47d2ec6c818a9c202fd833 (diff) |
Reformatting
Now I'm using ormolu instead of brittany for Haskell formatting
now. Figured I should just make all of these big changes at once.
Diffstat (limited to 'Biz/Language/Bs/Cli.hs')
-rw-r--r-- | Biz/Language/Bs/Cli.hs | 46 |
1 files changed, 29 insertions, 17 deletions
diff --git a/Biz/Language/Bs/Cli.hs b/Biz/Language/Bs/Cli.hs index 4c48c86..d2ac1e4 100644 --- a/Biz/Language/Bs/Cli.hs +++ b/Biz/Language/Bs/Cli.hs @@ -1,8 +1,10 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE NoImplicitPrelude #-} -module Language.Bs.Cli ( - run -) where + +module Language.Bs.Cli + ( run, + ) +where import Data.String import Data.Text.IO as TIO @@ -17,12 +19,12 @@ import System.Directory -- https://github.com/pcapriotti/optparse-applicative -- https://hackage.haskell.org/package/optparse-applicative -runScript :: FilePath -> IO () +runScript :: FilePath -> IO () runScript fname = do exists <- doesFileExist fname if exists - then TIO.readFile fname >>= evalFile fname - else TIO.putStrLn "File does not exist." + then TIO.readFile fname >>= evalFile fname + else TIO.putStrLn "File does not exist." data LineOpts = UseReplLineOpts | RunScriptLineOpts String @@ -30,14 +32,21 @@ 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") + 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") + UseReplLineOpts + <$ flag' + () + ( long "repl" + <> short 'r' + <> help "Run as interavtive read/evaluate/print/loop" + ) schemeEntryPoint :: LineOpts -> IO () schemeEntryPoint UseReplLineOpts = mainLoop --repl @@ -46,7 +55,10 @@ 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" ) + 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" + ) |