summaryrefslogtreecommitdiff
path: root/lore/Language/Bs/Primitives.hs
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2019-03-27 23:33:08 -0700
committerBen Sima <ben@bsima.me>2019-03-27 23:33:08 -0700
commit104f6e2921d0f0969cd33afbbc34b5f3127edbb4 (patch)
tree2e24a025ea0c223b6c0558fdffb98dcd6755e929 /lore/Language/Bs/Primitives.hs
parent794b248d0afb9ae7eae1bc0d8f6498a903e02e23 (diff)
bs: remove stdlib and cleanup
Diffstat (limited to 'lore/Language/Bs/Primitives.hs')
-rw-r--r--lore/Language/Bs/Primitives.hs12
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