diff options
| -rw-r--r-- | core/common.milch (renamed from stdlib/common.milch) | 0 | ||||
| -rw-r--r-- | core/maybe.milch (renamed from stdlib/maybe.milch) | 0 | ||||
| -rw-r--r-- | examples/aoc22_1.milch | 2 | ||||
| -rw-r--r-- | examples/test.milch | 6 | ||||
| -rw-r--r-- | src/Interpreter.hs | 5 |
5 files changed, 6 insertions, 7 deletions
diff --git a/stdlib/common.milch b/core/common.milch index f05c6a5..f05c6a5 100644 --- a/stdlib/common.milch +++ b/core/common.milch diff --git a/stdlib/maybe.milch b/core/maybe.milch index ef9e906..ef9e906 100644 --- a/stdlib/maybe.milch +++ b/core/maybe.milch diff --git a/examples/aoc22_1.milch b/examples/aoc22_1.milch index 7a4520a..becdaee 100644 --- a/examples/aoc22_1.milch +++ b/examples/aoc22_1.milch @@ -1,4 +1,4 @@ -(import "stdlib/common.milch") +(import "core/common.milch") ;; utils diff --git a/examples/test.milch b/examples/test.milch index d8d0077..a8225b1 100644 --- a/examples/test.milch +++ b/examples/test.milch @@ -1,11 +1,7 @@ -(import "stdlib/common.milch") +(import "core/common") (map (+ 1) [1 2 3]) - (foldr + 0 [1 2 3]) - (filter is-even [0 1 2 3 4 5]) - (reverse [1 2 3]) - (pipe 10 [(+ 1) (+ 2)]) diff --git a/src/Interpreter.hs b/src/Interpreter.hs index de77fc9..f9e00b9 100644 --- a/src/Interpreter.hs +++ b/src/Interpreter.hs @@ -217,7 +217,10 @@ evaluateImport asts = do case args of -- non-qualified import [AST { astNode = ASTString path }] -> do - LState { stateEnv = evaledRawEnv } <- lift $ execStateT (runScriptFile path) initialState + let checkedPath = if (not $ ".milch" `L.isSuffixOf` path) + then (path ++ ".milch") + else path + LState { stateEnv = evaledRawEnv } <- lift $ execStateT (runScriptFile checkedPath) initialState let exportedEnvMap = envThis evaledRawEnv env <- getEnv |
