diff options
Diffstat (limited to 'lore/Language/Bs/Primitives.hs')
-rw-r--r-- | lore/Language/Bs/Primitives.hs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lore/Language/Bs/Primitives.hs b/lore/Language/Bs/Primitives.hs index 6042b82..c074c59 100644 --- a/lore/Language/Bs/Primitives.hs +++ b/lore/Language/Bs/Primitives.hs @@ -8,7 +8,7 @@ -- over time. module Language.Bs.Primitives where -import Control.Exception hiding (handle) +import Control.Exception import Control.Monad.Except import Data.Text as T import Data.Text.IO as TIO @@ -87,10 +87,10 @@ wSlurp (Tape txt) = liftIO $ openURL txt wSlurp val = throw $ TypeMismatch "wSlurp expects a string, instead got: " val readTextFile :: T.Text -> Handle -> IO Expr -readTextFile fileName handle = do +readTextFile fileName h = do exists <- doesFileExist $ T.unpack fileName if exists - then (TIO.hGetContents handle) >>= (return . Tape) + then (TIO.hGetContents h) >>= (return . Tape) else throw $ ReadFileError $ T.concat [" file does not exist: ", fileName] put_ :: Expr -> Expr -> Eval Expr @@ -103,10 +103,10 @@ wFilePut fileName msg = withFile (T.unpack fileName) WriteMode go where go = putTextFile fileName msg putTextFile :: T.Text -> T.Text -> Handle -> IO Expr -putTextFile fileName msg handle = do - canWrite <- hIsWritable handle +putTextFile fileName msg h = do + canWrite <- hIsWritable h if canWrite - then (TIO.hPutStr handle msg) >> (return $ Tape msg) + then (TIO.hPutStr h msg) >> (return $ Tape msg) else throw $ ReadFileError $ T.concat [" file does not exist: ", fileName] binopFold :: Binary -> Expr -> [Expr] -> Eval Expr |