summaryrefslogtreecommitdiff
path: root/lore/Language/Bs/Eval.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lore/Language/Bs/Eval.hs')
-rw-r--r--lore/Language/Bs/Eval.hs24
1 files changed, 14 insertions, 10 deletions
diff --git a/lore/Language/Bs/Eval.hs b/lore/Language/Bs/Eval.hs
index 8246d7b..8495b88 100644
--- a/lore/Language/Bs/Eval.hs
+++ b/lore/Language/Bs/Eval.hs
@@ -2,26 +2,29 @@
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE NoImplicitPrelude #-}
module Language.Bs.Eval (
- evalText,
- evalFile,
- runParseTest,
- safeExec,
- runASTinEnv,
- basicEnv,
- fileToEvalForm,
- textToEvalForm,
- getFileContents
+ evalText
+, evalFile
+, runParseTest
+, safeExec
+, runASTinEnv
+, basicEnv
+, fileToEvalForm
+, textToEvalForm
+, getFileContents
) where
import Control.Exception
import Control.Monad.Reader
-import Data.Map as Map
+import qualified Data.Map as Map
+import Data.String
import qualified Data.Text as T
import qualified Data.Text.IO as TIO
import Language.Bs.Expr
import Language.Bs.Parser
import Language.Bs.Primitives
+import Protolude
import System.Directory
import Text.Parsec
@@ -131,6 +134,7 @@ applyFunc expr params args = bindArgsEval params args expr
bindArgsEval :: [Expr] -> [Expr] -> Expr -> Eval Expr
bindArgsEval params args expr = do
Env{..} <- ask
+
let newVars = zipWith (\a b -> (extractVar a,b)) params args
let (newEnv, newFenv) = Map.partition (not . isFunc) $ Map.fromList newVars
local (const $ Env (newEnv <> env) (newFenv <> fenv)) $ eval expr