From 494078074e5f620f11f72e48d0fc44cff73faaf2 Mon Sep 17 00:00:00 2001 From: Akshay Date: Fri, 23 Oct 2020 18:03:31 +0530 Subject: refactor internal datatypes to Base - avoids cyclic module dependencies - cleaner exports to Main module --- bin/Main.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'bin') 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 @@ module Main where +import Base (Expr (..)) import Control.Monad (liftM) import Control.Monad.Except (liftIO, runExceptT, throwError) import Environment @@ -7,7 +8,7 @@ import Error.Base (LispError (..), LispResult (..), unwrap) import Error.Pretty (defaults, showError) import Evaluator (eval) -import Parser (Expr (..), parseLispValue) +import Parser (parseLispValue) import System.Console.Readline import System.Environment (getArgs) import Text.ParserCombinators.Parsec @@ -29,7 +30,10 @@ repl env = do case inp of Nothing -> return () Just ",q" -> return () - Just i -> evalExpr env i >>= either (putStrLn . pp i) putStrLn >> repl env + Just i -> do + addHistory i + evalExpr env i >>= either (putStrLn . pp i) putStrLn + repl env main :: IO () -- cgit v1.2.3