diff options
author | Akshay <[email protected]> | 2020-10-23 13:33:31 +0100 |
---|---|---|
committer | Akshay <[email protected]> | 2020-10-23 13:33:31 +0100 |
commit | 494078074e5f620f11f72e48d0fc44cff73faaf2 (patch) | |
tree | 25aea03ceaae5fc3010e1894ae74d6eee0259cb5 /bin/Main.hs | |
parent | f68c7f7a140127320f9dadc57a3d2a485b86d3df (diff) |
refactor internal datatypes to Base
- avoids cyclic module dependencies
- cleaner exports to Main module
Diffstat (limited to 'bin/Main.hs')
-rw-r--r-- | bin/Main.hs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/bin/Main.hs b/bin/Main.hs index 18e1c53..3d9fad4 100644 --- a/bin/Main.hs +++ b/bin/Main.hs | |||
@@ -1,5 +1,6 @@ | |||
1 | module Main where | 1 | module Main where |
2 | 2 | ||
3 | import Base (Expr (..)) | ||
3 | import Control.Monad (liftM) | 4 | import Control.Monad (liftM) |
4 | import Control.Monad.Except (liftIO, runExceptT, throwError) | 5 | import Control.Monad.Except (liftIO, runExceptT, throwError) |
5 | import Environment | 6 | import Environment |
@@ -7,7 +8,7 @@ import Error.Base (LispError (..), LispResult (..), | |||
7 | unwrap) | 8 | unwrap) |
8 | import Error.Pretty (defaults, showError) | 9 | import Error.Pretty (defaults, showError) |
9 | import Evaluator (eval) | 10 | import Evaluator (eval) |
10 | import Parser (Expr (..), parseLispValue) | 11 | import Parser (parseLispValue) |
11 | import System.Console.Readline | 12 | import System.Console.Readline |
12 | import System.Environment (getArgs) | 13 | import System.Environment (getArgs) |
13 | import Text.ParserCombinators.Parsec | 14 | import Text.ParserCombinators.Parsec |
@@ -29,7 +30,10 @@ repl env = do | |||
29 | case inp of | 30 | case inp of |
30 | Nothing -> return () | 31 | Nothing -> return () |
31 | Just ",q" -> return () | 32 | Just ",q" -> return () |
32 | Just i -> evalExpr env i >>= either (putStrLn . pp i) putStrLn >> repl env | 33 | Just i -> do |
34 | addHistory i | ||
35 | evalExpr env i >>= either (putStrLn . pp i) putStrLn | ||
36 | repl env | ||
33 | 37 | ||
34 | 38 | ||
35 | main :: IO () | 39 | main :: IO () |