From cda4a8a3458c08ab9413cb65585913aa5bcab8e3 Mon Sep 17 00:00:00 2001 From: darkf Date: Tue, 29 Oct 2013 02:48:06 -0700 Subject: [PATCH] Allow slashed module names and use their base name --- interp.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interp.hs b/interp.hs index 75f3660..6ed6cdb 100644 --- a/interp.hs +++ b/interp.hs @@ -12,7 +12,7 @@ import Control.Monad.Trans (lift) import Control.Monad.Trans.State (StateT, runStateT, evalStateT, get, put) import System.IO (Handle, hPutStr, hGetLine, hFlush, hClose, hIsEOF, openBinaryFile, IOMode(..), stdout, stdin) import System.Directory (doesFileExist) -import System.FilePath (FilePath, splitExtension) +import System.FilePath (FilePath, splitExtension, takeBaseName) import AST import Parser (parseProgram) @@ -191,7 +191,7 @@ _Import (StrV modname) = do let path = modname ++ ".lamb" exists <- doesFileExist path if exists then - return (path, fst $ splitExtension path) + return (path, takeBaseName path) else error $ "module " ++ modname ++ " couldn't be found" initialState = ([stdout, stdin],