diff options
author | Marvin Borner | 2022-08-12 18:43:27 +0200 |
---|---|---|
committer | Marvin Borner | 2022-08-12 19:47:47 +0200 |
commit | cbc9a382e356951896a21f80f52e0e5b3e8c4e1f (patch) | |
tree | 4ba22cea48d2ac36a8ab8c12557007431602a6ab /src/Eval.hs | |
parent | cce495b3b4440997274ecab3d72ed61d6a50b007 (diff) |
Added prefix support
Needs some work regarding namespaces
Diffstat (limited to 'src/Eval.hs')
-rw-r--r-- | src/Eval.hs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Eval.hs b/src/Eval.hs index 6b165b2..445e41d 100644 --- a/src/Eval.hs +++ b/src/Eval.hs @@ -67,7 +67,10 @@ evalApp f g sub = ) evalInfix :: Expression -> String -> Expression -> Environment -> Program (Failable Expression) -evalInfix le i re = evalExp $ Application (Application (Variable i) le) re +evalInfix le i re = evalExp $ Application (Application (Variable $ "(" ++ i ++ ")") le) re + +evalPrefix :: String -> Expression -> Environment -> Program (Failable Expression) +evalPrefix p e = evalExp $ Application (Variable $ p ++ "(") e evalExp :: Expression -> Environment -> Program (Failable Expression) evalExp idx@(Bruijn _ ) = const $ pure $ Right idx @@ -75,6 +78,7 @@ evalExp ( Variable var) = evalVar var evalExp ( Abstraction e) = evalAbs e evalExp ( Application f g) = evalApp f g evalExp (Infix le i re) = evalInfix le i re +evalExp (Prefix p e) = evalPrefix p e evalDefine :: String -> Expression -> Environment -> Program (Failable Expression) |