aboutsummaryrefslogtreecommitdiff
path: root/bin/Main.hs
diff options
context:
space:
mode:
authorAkshay <[email protected]>2020-10-23 13:33:31 +0100
committerAkshay <[email protected]>2020-10-23 13:33:31 +0100
commit494078074e5f620f11f72e48d0fc44cff73faaf2 (patch)
tree25aea03ceaae5fc3010e1894ae74d6eee0259cb5 /bin/Main.hs
parentf68c7f7a140127320f9dadc57a3d2a485b86d3df (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.hs8
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 @@
1module Main where 1module Main where
2 2
3import Base (Expr (..))
3import Control.Monad (liftM) 4import Control.Monad (liftM)
4import Control.Monad.Except (liftIO, runExceptT, throwError) 5import Control.Monad.Except (liftIO, runExceptT, throwError)
5import Environment 6import Environment
@@ -7,7 +8,7 @@ import Error.Base (LispError (..), LispResult (..),
7 unwrap) 8 unwrap)
8import Error.Pretty (defaults, showError) 9import Error.Pretty (defaults, showError)
9import Evaluator (eval) 10import Evaluator (eval)
10import Parser (Expr (..), parseLispValue) 11import Parser (parseLispValue)
11import System.Console.Readline 12import System.Console.Readline
12import System.Environment (getArgs) 13import System.Environment (getArgs)
13import Text.ParserCombinators.Parsec 14import 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
35main :: IO () 39main :: IO ()