summaryrefslogtreecommitdiff
path: root/lore
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2019-03-27 23:07:51 -0700
committerBen Sima <ben@bsima.me>2019-03-27 23:07:51 -0700
commit794b248d0afb9ae7eae1bc0d8f6498a903e02e23 (patch)
treeb9a10065ed357f8ab2ad8cc112a88a197ec445f1 /lore
parent4ecc513e5917057f50150e2cb0a1d63d6010f0d7 (diff)
bs: formatting
Diffstat (limited to 'lore')
-rw-r--r--lore/Language/Bs/Eval.hs5
-rw-r--r--lore/Language/Bs/Expr.hs3
-rw-r--r--lore/Language/Bs/Repl.hs2
-rw-r--r--lore/core.scm1
4 files changed, 6 insertions, 5 deletions
diff --git a/lore/Language/Bs/Eval.hs b/lore/Language/Bs/Eval.hs
index 8495b88..a3232bc 100644
--- a/lore/Language/Bs/Eval.hs
+++ b/lore/Language/Bs/Eval.hs
@@ -95,7 +95,8 @@ getFileContents fname = do
if exists then TIO.readFile fname else return "File does not exist."
textToEvalForm :: T.Text -> T.Text -> Eval Expr
-textToEvalForm std input = either (throw . ParseError . show ) evalBody $ parseWithLib std input
+textToEvalForm std input = either (throw . ParseError . show ) evalBody
+ $ parseWithLib std input
evalText :: T.Text -> IO () --REPL
evalText textExpr = do
@@ -239,7 +240,7 @@ eval (List ((:) x xs)) = do
throw $ NotFunction funVar
updateEnv :: T.Text -> Expr -> Env -> Env
-updateEnv var e@(IFun _) Env{..} = Env env $ Map.insert var e fenv
+updateEnv var e@(IFun _) Env{..} = Env env $ Map.insert var e fenv
updateEnv var e@(Func _ _) Env{..} = Env env $ Map.insert var e fenv
updateEnv var e Env{..} = Env (Map.insert var e env) fenv
diff --git a/lore/Language/Bs/Expr.hs b/lore/Language/Bs/Expr.hs
index d386d0e..a39c7b6 100644
--- a/lore/Language/Bs/Expr.hs
+++ b/lore/Language/Bs/Expr.hs
@@ -128,8 +128,9 @@ instance Pretty LispErrorType where
textStrict "bad special form:"
<$$> textStrict txt
- NotFunction _ ->
+ NotFunction expr ->
textStrict "not a function"
+ <$$> pretty expr
UnboundVar txt ->
textStrict "unbound variable:"
diff --git a/lore/Language/Bs/Repl.hs b/lore/Language/Bs/Repl.hs
index 35e473f..64ffaa2 100644
--- a/lore/Language/Bs/Repl.hs
+++ b/lore/Language/Bs/Repl.hs
@@ -21,7 +21,7 @@ repl = do
minput <- getInputLine "bs> "
case minput of
Nothing -> outputStrLn "bye."
- Just input -> liftIO (process input) >> repl
+ Just input -> (liftIO $ process input) >> repl
--Just input -> (liftIO $ processToAST input) >> repl
process :: String -> IO ()
diff --git a/lore/core.scm b/lore/core.scm
index 9760318..3d411c4 100644
--- a/lore/core.scm
+++ b/lore/core.scm
@@ -1,7 +1,6 @@
;; standard library for bs
(define (not x) (if x #f #t))
-
(define (null? obj) (if (eqv? obj '()) #t #f))
(define (list objs) objs)
(define (identity obj) obj)