aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Helper.hs
diff options
context:
space:
mode:
authorMarvin Borner2022-08-09 21:11:41 +0200
committerMarvin Borner2022-08-09 21:14:14 +0200
commit833e8de42a7dc39569cd66e7194aa10f39267d95 (patch)
tree0bbfd88ca069b9af9e712bea6c72d758f5ad42b2 /src/Helper.hs
parent34222c0c05844e5ea1f5ea7c3f7ad72d4dff70ac (diff)
Added import loop error
Diffstat (limited to 'src/Helper.hs')
-rw-r--r--src/Helper.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Helper.hs b/src/Helper.hs
index 6c1509d..821e68c 100644
--- a/src/Helper.hs
+++ b/src/Helper.hs
@@ -18,7 +18,7 @@ printContext str = p $ lines str
errPrefix :: String
errPrefix = "\ESC[41mERROR\ESC[0m "
-data Error = SyntaxError String | UndeclaredFunction String | InvalidIndex Int | FailedTest Expression Expression Expression Expression | ContextualError Error String
+data Error = SyntaxError String | UndeclaredFunction String | InvalidIndex Int | FailedTest Expression Expression Expression Expression | ContextualError Error String | ImportError String
instance Show Error where
show (ContextualError err ctx) = show err <> "\n" <> (printContext ctx)
show (SyntaxError err ) = errPrefix <> "invalid syntax\nnear " <> err
@@ -35,6 +35,7 @@ instance Show Error where
<> show red1
<> " = "
<> show red2
+ show (ImportError path) = errPrefix <> "invalid import " <> show path
type Failable = Either Error
data Expression = Bruijn Int | Variable String | Abstraction Expression | Application Expression Expression
@@ -49,6 +50,11 @@ instance Show Expression where
"\ESC[33m(\ESC[0m" <> show exp1 <> " " <> show exp2 <> "\ESC[33m)\ESC[0m"
type EnvDef = (String, Expression)
+-- TODO: Add EvalConf to EnvState?
+data EvalConf = EvalConf
+ { isRepl :: Bool
+ , evalPaths :: [String]
+ }
data Environment = Environment [(EnvDef, Environment)]
type Program = State Environment